diff options
author | Raphael <raphael@google.com> | 2010-04-02 10:25:33 -0700 |
---|---|---|
committer | Raphael <raphael@google.com> | 2010-04-02 10:25:33 -0700 |
commit | 8cd20552421781666db82b2e03d0b7beed4d2ea7 (patch) | |
tree | 32feaf0a8b7c86182a557a15bd235fdfd1c08d62 | |
parent | c33045039e2d5baf7d1376be1bb2ca4bd88f783d (diff) | |
download | sdk-8cd20552421781666db82b2e03d0b7beed4d2ea7.zip sdk-8cd20552421781666db82b2e03d0b7beed4d2ea7.tar.gz sdk-8cd20552421781666db82b2e03d0b7beed4d2ea7.tar.bz2 |
GLE1: stop showing outline/properties when opening GLE.
This CL reverts two annoying behaviors when using GLE:
- it stops opening the outline/properties (either for GLE1 or GLE2...
in GLE2 will need to use different views and have a better
behavior anyway.)
- it selects the XML text editor by default for GLE1 since
the graphical one is mostly useless.
Change-Id: I634e6dbe3575fbcacdb61a487e8828043325b752
2 files changed, 46 insertions, 5 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidEditor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidEditor.java index 0a48284..c2b1b28 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidEditor.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/AndroidEditor.java @@ -164,6 +164,15 @@ public abstract class AndroidEditor extends FormEditor implements IResourceChang abstract protected void createFormPages(); /** + * Called by the base class {@link AndroidEditor} once all pages (custom form pages + * as well as text editor page) have been created. This give a chance to deriving + * classes to adjust behavior once the text page has been created. + */ + protected void postCreatePages() { + // Nothing in the base class. + } + + /** * Creates the initial UI Root Node, including the known mandatory elements. * @param force if true, a new UiManifestNode is recreated even if it already exists. */ @@ -199,8 +208,8 @@ public abstract class AndroidEditor extends FormEditor implements IResourceChang mIsCreatingPage = true; createFormPages(); createTextEditor(); - createUndoRedoActions(); + postCreatePages(); mIsCreatingPage = false; } @@ -305,6 +314,11 @@ public abstract class AndroidEditor extends FormEditor implements IResourceChang protected void pageChange(int newPageIndex) { super.pageChange(newPageIndex); + // Do not record page changes during creation of pages + if (mIsCreatingPage) { + return; + } + if (getEditorInput() instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) getEditorInput()).getFile(); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java index c407ff9..c059a41 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java @@ -164,12 +164,14 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa input.toString()); } - // It is possible that the Layout Editor alreadys exits if a different version + // It is possible that the Layout Editor already exits if a different version // of the same layout is being opened (either through "open" action from // the user, or through a configuration change in the configuration selector.) if (mGraphicalEditor == null) { - if (System.getenv("USE_GLE2") != null) { //$NON-NLS-1$ //$NON-NLS-2$ + String useGle2 = System.getenv("USE_GLE2"); //$NON-NLS-1$ + + if (useGle2 != null && !useGle2.equals("0")) { //$NON-NLS-1$ mGraphicalEditor = new GraphicalEditorPart(this); } else { mGraphicalEditor = new GraphicalLayoutEditor(this); @@ -196,6 +198,25 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa } } + @Override + protected void postCreatePages() { + super.postCreatePages(); + + // This is called after the createFormPages() and createTextPage() methods have + // been called. Usually we select the first page (e.g. the GLE here) but right + // now we're going to temporarily select the last page (the XML text editor) if + // GLE1 is being used. That's because GLE1 is mostly useless and being deprecated. + // + // Note that this sets the default page. Eventually a default page might be + // restored by selectDefaultPage() later based on the last page used by the user. + // + // TODO revert this once GLE2 becomes useful and is the default. + + if (mGraphicalEditor instanceof GraphicalLayoutEditor) { + setActivePage(getPageCount() - 1); + } + } + /* (non-java doc) * Change the tab/title name to include the name of the layout. */ @@ -353,8 +374,14 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa } public void partOpened(IWorkbenchPart part) { - EclipseUiHelper.showView(EclipseUiHelper.CONTENT_OUTLINE_VIEW_ID, false /* activate */); - EclipseUiHelper.showView(EclipseUiHelper.PROPERTY_SHEET_VIEW_ID, false /* activate */); + /* + * We used to automatically bring the outline and the property sheet to view + * when opening the editor. This behavior has always been a mixed bag and not + * exactly satisfactory. GLE1 is being useless/deprecated and GLE2 will need to + * improve on that, so right now let's comment this out. + */ + //EclipseUiHelper.showView(EclipseUiHelper.CONTENT_OUTLINE_VIEW_ID, false /* activate */); + //EclipseUiHelper.showView(EclipseUiHelper.PROPERTY_SHEET_VIEW_ID, false /* activate */); } public class UiEditorActions extends UiActions { |