[Pydev-cvs] org.python.pydev.core/src/org/python/pydev/core/uiutils DialogMemento.java, 1.1, 1.2 Ru
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 19:58:01
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/uiutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19948/src/org/python/pydev/core/uiutils Modified Files: DialogMemento.java RunInUiThread.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: RunInUiThread.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/uiutils/RunInUiThread.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunInUiThread.java 22 May 2006 13:01:13 -0000 1.1 --- RunInUiThread.java 27 Sep 2008 19:57:36 -0000 1.2 *************** *** 5,22 **** public class RunInUiThread { ! public static void sync(Runnable r){ ! if (Display.getCurrent() == null){ ! Display.getDefault().syncExec(r); ! }else{ ! r.run(); ! } ! } ! ! public static void async(Runnable r){ ! if (Display.getCurrent() == null){ ! Display.getDefault().asyncExec(r); ! }else{ ! r.run(); ! } ! } } --- 5,22 ---- public class RunInUiThread { ! public static void sync(Runnable r){ ! if (Display.getCurrent() == null){ ! Display.getDefault().syncExec(r); ! }else{ ! r.run(); ! } ! } ! ! public static void async(Runnable r){ ! if (Display.getCurrent() == null){ ! Display.getDefault().asyncExec(r); ! }else{ ! r.run(); ! } ! } } Index: DialogMemento.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/uiutils/DialogMemento.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DialogMemento.java 22 Feb 2006 12:44:48 -0000 1.1 --- DialogMemento.java 27 Sep 2008 19:57:35 -0000 1.2 *************** *** 14,33 **** * ! public boolean close() { ! memento.writeSettings(getShell()); ! return super.close(); ! } ! public Control createDialogArea(Composite parent) { ! memento.readSettings(); ! return super.createDialogArea(parent); ! } protected Point getInitialSize() { ! return memento.getInitialSize(super.getInitialSize(), getShell()); } ! protected Point getInitialLocation(Point initialSize) { ! return memento.getInitialLocation(initialSize, super.getInitialLocation(initialSize), getShell()); } --- 14,33 ---- * ! public boolean close() { ! memento.writeSettings(getShell()); ! return super.close(); ! } ! public Control createDialogArea(Composite parent) { ! memento.readSettings(); ! return super.createDialogArea(parent); ! } protected Point getInitialSize() { ! return memento.getInitialSize(super.getInitialSize(), getShell()); } ! protected Point getInitialLocation(Point initialSize) { ! return memento.getInitialLocation(initialSize, super.getInitialLocation(initialSize), getShell()); } *************** *** 36,125 **** public class DialogMemento { ! private IDialogSettings fSettings; ! private Point fLocation; ! private Point fSize; ! private static final String DIALOG_SETTINGS= "org.python.pydev.core.uiutils.DialogMemento"; ! private static final String WIDTH= "width"; ! private static final String HEIGHT= "height"; ! ! public DialogMemento(Shell parent) { ! this(parent, DIALOG_SETTINGS); ! } ! public DialogMemento(Shell parent, String dialogSettings) { ! IDialogSettings settings= CorePlugin.getDefault().getDialogSettings(); ! fSettings= settings.getSection(dialogSettings); ! if (fSettings == null) { ! fSettings= new DialogSettings(dialogSettings); ! settings.addSection(fSettings); ! fSettings.put(WIDTH, 480); ! fSettings.put(HEIGHT, 320); ! } ! } ! ! public Point getInitialSize(Point initialSize, Shell shell) { ! if (fSize != null) { ! initialSize.x= Math.max(initialSize.x, fSize.x); ! initialSize.y= Math.max(initialSize.y, fSize.y); ! Rectangle display= shell.getDisplay().getClientArea(); ! initialSize.x= Math.min(initialSize.x, display.width); ! initialSize.y= Math.min(initialSize.y, display.height); ! } ! return initialSize; ! } ! ! public Point getInitialLocation(Point initialSize, Point initialLocation, Shell shell) { ! if (fLocation != null) { ! initialLocation.x= fLocation.x; ! initialLocation.y= fLocation.y; ! Rectangle display= shell.getDisplay().getClientArea(); ! int xe= initialLocation.x + initialSize.x; ! if (xe > display.width) { ! initialLocation.x-= xe - display.width; ! } ! int ye= initialLocation.y + initialSize.y; ! if (ye > display.height) { ! initialLocation.y-= ye - display.height; ! } ! } ! return initialLocation; ! } ! ! ! ! /** ! * Initializes itself from the dialog settings with the same state ! * as at the previous invocation. ! */ ! public void readSettings() { ! try { ! int x= fSettings.getInt("x"); ! int y= fSettings.getInt("y"); ! fLocation= new Point(x, y); ! } catch (NumberFormatException e) { ! fLocation= null; ! } ! try { ! int width= fSettings.getInt("width"); ! int height= fSettings.getInt("height"); ! fSize= new Point(width, height); ! } catch (NumberFormatException e) { ! fSize= null; ! } ! } ! /** ! * Stores it current configuration in the dialog store. ! */ ! public void writeSettings(Shell shell) { ! Point location= shell.getLocation(); ! fSettings.put("x", location.x); ! fSettings.put("y", location.y); ! Point size= shell.getSize(); ! fSettings.put("width", size.x); ! fSettings.put("height", size.y); ! } } --- 36,125 ---- public class DialogMemento { ! private IDialogSettings fSettings; ! private Point fLocation; ! private Point fSize; ! private static final String DIALOG_SETTINGS= "org.python.pydev.core.uiutils.DialogMemento"; ! private static final String WIDTH= "width"; ! private static final String HEIGHT= "height"; ! ! public DialogMemento(Shell parent) { ! this(parent, DIALOG_SETTINGS); ! } ! public DialogMemento(Shell parent, String dialogSettings) { ! IDialogSettings settings= CorePlugin.getDefault().getDialogSettings(); ! fSettings= settings.getSection(dialogSettings); ! if (fSettings == null) { ! fSettings= new DialogSettings(dialogSettings); ! settings.addSection(fSettings); ! fSettings.put(WIDTH, 480); ! fSettings.put(HEIGHT, 320); ! } ! } ! ! public Point getInitialSize(Point initialSize, Shell shell) { ! if (fSize != null) { ! initialSize.x= Math.max(initialSize.x, fSize.x); ! initialSize.y= Math.max(initialSize.y, fSize.y); ! Rectangle display= shell.getDisplay().getClientArea(); ! initialSize.x= Math.min(initialSize.x, display.width); ! initialSize.y= Math.min(initialSize.y, display.height); ! } ! return initialSize; ! } ! ! public Point getInitialLocation(Point initialSize, Point initialLocation, Shell shell) { ! if (fLocation != null) { ! initialLocation.x= fLocation.x; ! initialLocation.y= fLocation.y; ! Rectangle display= shell.getDisplay().getClientArea(); ! int xe= initialLocation.x + initialSize.x; ! if (xe > display.width) { ! initialLocation.x-= xe - display.width; ! } ! int ye= initialLocation.y + initialSize.y; ! if (ye > display.height) { ! initialLocation.y-= ye - display.height; ! } ! } ! return initialLocation; ! } ! ! ! ! /** ! * Initializes itself from the dialog settings with the same state ! * as at the previous invocation. ! */ ! public void readSettings() { ! try { ! int x= fSettings.getInt("x"); ! int y= fSettings.getInt("y"); ! fLocation= new Point(x, y); ! } catch (NumberFormatException e) { ! fLocation= null; ! } ! try { ! int width= fSettings.getInt("width"); ! int height= fSettings.getInt("height"); ! fSize= new Point(width, height); ! } catch (NumberFormatException e) { ! fSize= null; ! } ! } ! /** ! * Stores it current configuration in the dialog store. ! */ ! public void writeSettings(Shell shell) { ! Point location= shell.getLocation(); ! fSettings.put("x", location.x); ! fSettings.put("y", location.y); ! Point size= shell.getSize(); ! fSettings.put("width", size.x); ! fSettings.put("height", size.y); ! } } |