aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.adt/src/com
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2010-11-18 20:03:46 -0800
committerAndroid Code Review <code-review@android.com>2010-11-18 20:03:46 -0800
commita6ed5f2625d825a85cb7579b7017b1ea02a984ee (patch)
tree1f5f6a9f57a624cca2c1246d72efb48efc68de16 /eclipse/plugins/com.android.ide.eclipse.adt/src/com
parenta5f4fc50d54d45324aa701755ee0e044bd5537f8 (diff)
parent06ad677dd9875e20549f82bc2abf3e2b4cd4b321 (diff)
downloadsdk-a6ed5f2625d825a85cb7579b7017b1ea02a984ee.zip
sdk-a6ed5f2625d825a85cb7579b7017b1ea02a984ee.tar.gz
sdk-a6ed5f2625d825a85cb7579b7017b1ea02a984ee.tar.bz2
Merge "Cleanup and comment the refresh code in GLE2."
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java46
1 files changed, 16 insertions, 30 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
index 4335754..73711aa 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
@@ -184,7 +184,6 @@ public class GraphicalEditorPart extends EditorPart
private ProjectCallback mProjectCallback;
private ILayoutLog mLogger;
- private boolean mNeedsXmlReload = false;
private boolean mNeedsRecompute = false;
private TargetListener mTargetListener;
@@ -874,7 +873,7 @@ public class GraphicalEditorPart extends EditorPart
* Responds to a page change that made the Graphical editor page the activated page.
*/
public void activated() {
- if (mNeedsRecompute || mNeedsXmlReload) {
+ if (mNeedsRecompute) {
recomputeLayout();
}
}
@@ -965,41 +964,28 @@ public class GraphicalEditorPart extends EditorPart
* Callback for XML model changed. Only update/recompute the layout if the editor is visible
*/
public void onXmlModelChanged() {
+ // To optimize the rendering when the user is editing in the XML pane, we don't
+ // refresh the editor if it's not the active part.
+ //
+ // This behavior is acceptable when the editor is the single "full screen" part
+ // (as in this case active means visible.)
+ // Unfortunately this breaks in 2 cases:
+ // - when performing a drag'n'drop from one editor to another, the target is not
+ // properly refreshed before it becomes active.
+ // - when duplicating the editor window and placing both editors side by side (xml in one
+ // and canvas in the other one), the canvas may not be refreshed when the XML is edited.
+ //
+ // TODO find a way to really query whether the pane is visible, not just active.
+
if (mLayoutEditor.isGraphicalEditorActive()) {
- doXmlReload(true /* force */);
recomputeLayout();
} else {
- mNeedsXmlReload = true;
- }
- }
-
- /**
- * Actually performs the XML reload
- * @see #onXmlModelChanged()
- */
- private void doXmlReload(boolean force) {
- if (force || mNeedsXmlReload) {
-
- // TODO : update the mLayoutCanvas, preserving the current selection if possible.
-
-// GraphicalViewer viewer = getGraphicalViewer();
-//
-// // try to preserve the selection before changing the content
-// SelectionManager selMan = viewer.getSelectionManager();
-// ISelection selection = selMan.getSelection();
-//
-// try {
-// viewer.setContents(getModel());
-// } finally {
-// selMan.setSelection(selection);
-// }
-
- mNeedsXmlReload = false;
+ // Remember we want to recompute as soon as the editor becomes active.
+ mNeedsRecompute = true;
}
}
public void recomputeLayout() {
- doXmlReload(false /* force */);
try {
if (!ensureFileValid()) {
return;