Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 127480 Details for
Bug 162102
[Workbench] User configurability for MAX_RECENT_WORKSPACES
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch that includes Help changes and externalizes the UI strings
162102-patch.txt (text/plain), 26.49 KB, created by
Eric Rizzo
on 2009-03-04 09:51:33 EST
(
hide
)
Description:
Patch that includes Help changes and externalizes the UI strings
Filename:
MIME Type:
Creator:
Eric Rizzo
Created:
2009-03-04 09:51:33 EST
Size:
26.49 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java,v >retrieving revision 1.20 >diff -u -r1.20 IWorkbenchHelpContextIds.java >--- Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java 24 Mar 2008 19:21:57 -0000 1.20 >+++ Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java 4 Mar 2009 14:49:27 -0000 >@@ -288,6 +288,9 @@ > public static final String STARTUP_PREFERENCE_PAGE = PREFIX > + "startup_preference_page_context"; //$NON-NLS-1$ > >+ public static final String WORKSPACES_PREFERENCE_PAGE = PREFIX >+ + "workspaces_preference_page_context"; //$NON-NLS-1$ >+ > public static final String RESPONSIVE_UI = PREFIX + "responsive_ui_context"; //$NON-NLS-1$ > > // // Windows >#P org.eclipse.platform.doc.user >Index: reference/ref-startup.htm >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.platform.doc.user/reference/ref-startup.htm,v >retrieving revision 1.20 >diff -u -r1.20 ref-startup.htm >--- reference/ref-startup.htm 30 May 2006 15:14:57 -0000 1.20 >+++ reference/ref-startup.htm 4 Mar 2009 14:49:28 -0000 >@@ -19,7 +19,7 @@ > <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"> > <strong>General > Startup and Shutdown</strong></a> > >- preference page allows the selection >+ preference page allows the selection > of plug-ins to be automatically activated during workbench startup. </P> > > >@@ -31,32 +31,26 @@ > <table BORDER CELLSPACING=0 > > <caption> > </caption> >- <tr> >+ <tr> > <th> <div CLASS="Para">Option</div></th> > <th> <div CLASS="Para">Description</div></th> > <th> <div CLASS="Para">Default</div></th> > </tr> >- <tr> >- <td> <div CLASS="Para">Prompt for workspace on startup</div></td> >- <td> <div CLASS="Para">If this option is turned on then the workbench will >- prompt you each time it is started for what workspace to use.</div></td> >- <td> <div CLASS="Para">On</div></td> >- </tr> >- <tr> >+ <tr> > <td> <div CLASS="Para">Refresh workspace on startup</div></td> >- <td> <div CLASS="Para">If this option is turned on then the workbench will >+ <td> <div CLASS="Para">If this option is turned on then the workbench will > synchronize its contents with the file system on startup.</div></td> > <td> <div CLASS="Para">Off</div></td> > </tr> >- <tr> >+ <tr> > <td> <div CLASS="Para">Confirm exit when closing last window</div></td> >- <td> <div CLASS="Para">If this option is turned on then the workbench will >+ <td> <div CLASS="Para">If this option is turned on then the workbench will > ask if you wish to exit when closing the last window if.</div></td> > <td> <div CLASS="Para">On</div></td> > </tr> >- <tr> >+ <tr> > <td> <div CLASS="Para">Plug-ins activated on startup</div></td> >- <td> <div CLASS="Para">This option allows you to select which available plug-ins >+ <td> <div CLASS="Para">This option allows you to select which available plug-ins > should be activated on startup.</div></td> > <td> <div CLASS="Para"></div></td> > </tr> >Index: contexts_Workbench.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.platform.doc.user/contexts_Workbench.xml,v >retrieving revision 1.84 >diff -u -r1.84 contexts_Workbench.xml >--- contexts_Workbench.xml 16 Dec 2008 10:19:18 -0000 1.84 >+++ contexts_Workbench.xml 4 Mar 2009 14:49:28 -0000 >@@ -828,6 +828,10 @@ > <description>This page shows you all of the plug-ins that are activated when the workbench starts.</description> > <topic label="Preferences - Startup" href="reference/ref-startup.htm"/> > </context> >+ <context id="workspaces_preference_page_context"> >+ <description>This page allows you to control the prompting to select a workspace when the workbench starts.</description> >+ <topic label="Preferences - Startup Workspaces" href="reference/ref-startup-workspaces.htm"/> >+ </context> > <context id="working_set_new_wizard_context"> > <description>This wizard will guide you through the process of creating a working set.</description> > </context> >Index: topics_Reference.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.platform.doc.user/topics_Reference.xml,v >retrieving revision 1.94 >diff -u -r1.94 topics_Reference.xml >--- topics_Reference.xml 10 Feb 2009 10:18:12 -0000 1.94 >+++ topics_Reference.xml 4 Mar 2009 14:49:28 -0000 >@@ -146,6 +146,7 @@ > </enablement> > </topic> > <topic label="Startup and Shutdown" href="reference/ref-startup.htm"></topic> >+ <topic label="Workspaces" href="reference/ref-startup-workspaces.htm"></topic> > <topic label="Team" href="reference/ref-19.htm"> > <enablement> > <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.team.ui"/> >Index: reference/ref-startup-workspaces.htm >=================================================================== >RCS file: reference/ref-startup-workspaces.htm >diff -N reference/ref-startup-workspaces.htm >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ reference/ref-startup-workspaces.htm 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> >+<HEAD> >+ >+<meta name="copyright" content="Copyright (c) Eric Rizzo and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > >+ >+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> >+<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> >+ >+<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"></script> >+<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> >+<title>Startup and Shutdown, Workspaces</title> >+ >+</HEAD> >+<BODY BGCOLOR="#ffffff"> >+<H1 CLASS="Head"> Startup and Shutdown, Workspaces </H1> >+<P CLASS="Para"> The >+ >+ <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Startup.Workspaces)")'> >+ <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"> >+ <strong>General > Startup and Shutdown > Workspaces</strong></a> >+ >+ preference page allows configuration of the workspace prompting during IDE startup.</P> >+ >+ >+<table BORDER CELLSPACING=0 > >+ <caption> >+ </caption> >+ <tr> >+ <th> <div CLASS="Para">Option</div></th> >+ <th> <div CLASS="Para">Description</div></th> >+ <th> <div CLASS="Para">Default</div></th> >+ </tr> >+ <tr> >+ <td> <div CLASS="Para">Prompt for workspace on startup</div></td> >+ <td> <div CLASS="Para">If this option is turned on then the workbench will >+ prompt you each time it is started for what workspace to use.</div></td> >+ <td> <div CLASS="Para">On</div></td> >+ </tr> >+ <tr> >+ <td> <div CLASS="Para">Number of recent workspaces to remember</div></td> >+ <td> <div CLASS="Para">The maximum number of recently-used workspaces that will be remembered and presented in the "Workspace Launcher" dialog.</div></td> >+ <td> <div CLASS="Para">5</div></td> >+ </tr> >+ <tr> >+ <td> <div CLASS="Para">Recent workspaces</div></td> >+ <td> <div CLASS="Para">The list of recently used workspaces that are presented in the "Workspace Launcher" dialog.</div></td> >+ <td> <div CLASS="Para"><none></div></td> >+ </tr> >+</table> >+ >+<P>Here is what the workspaces preference page looks like: </P> >+ >+ >+<P> >+</P> >+ >+ >+<P> >+</P> >+ >+</BODY> >+</HTML> >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/messages.properties,v >retrieving revision 1.162 >diff -u -r1.162 messages.properties >--- src/org/eclipse/ui/internal/ide/messages.properties 20 Jan 2009 21:10:58 -0000 1.162 >+++ src/org/eclipse/ui/internal/ide/messages.properties 4 Mar 2009 14:49:31 -0000 >@@ -269,6 +269,10 @@ > > RebuildAction_text = Rebuild Pro&ject > RebuildAction_tooltip = Full Build Of Selected Projects >+RecentWorkspacesPreferencePage_NumberOfWorkspaces_label=&Number of recent workspaces to remember: >+RecentWorkspacesPreferencePage_PromptAtStartup_label=Prompt for &workspace on startup >+RecentWorkspacesPreferencePage_RecentWorkspacesList_label=Recent workspaces >+RecentWorkspacesPreferencePage_RemoveButton_label=&Remove > > RefreshAction_text = Re&fresh > RefreshAction_toolTip = Refresh >Index: src/org/eclipse/ui/internal/ide/ChooseWorkspaceData.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/ChooseWorkspaceData.java,v >retrieving revision 1.21 >diff -u -r1.21 ChooseWorkspaceData.java >--- src/org/eclipse/ui/internal/ide/ChooseWorkspaceData.java 24 Mar 2008 19:13:35 -0000 1.21 >+++ src/org/eclipse/ui/internal/ide/ChooseWorkspaceData.java 4 Mar 2009 14:49:30 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2007 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Eric Rizzo - added API to set the list of recent workspaces. > *******************************************************************************/ > package org.eclipse.ui.internal.ide; > >@@ -192,6 +193,17 @@ > } > > /** >+ * Sets the list of recent workspaces. >+ */ >+ public void setRecentWorkspaces(String[] workspaces) { >+ if (workspaces == null) { >+ recentWorkspaces = new String[0]; >+ } else { >+ recentWorkspaces = workspaces; >+ } >+ } >+ >+ /** > * Update the persistent store. Call this function after the currently > * selected value has been found to be ok. > */ >Index: src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java,v >retrieving revision 1.59 >diff -u -r1.59 IDEWorkbenchMessages.java >--- src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 20 Jan 2009 21:10:58 -0000 1.59 >+++ src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 4 Mar 2009 14:49:31 -0000 >@@ -499,6 +499,13 @@ > public static String StartupPreferencePage_launchPromptButton; > public static String StartupPreferencePage_exitPromptButton; > >+ // --- Startup -> Workspaces preferences --- >+ public static String RecentWorkspacesPreferencePage_NumberOfWorkspaces_label; >+ public static String RecentWorkspacesPreferencePage_PromptAtStartup_label; >+ public static String RecentWorkspacesPreferencePage_RecentWorkspacesList_label; >+ public static String RecentWorkspacesPreferencePage_RemoveButton_label; >+ >+ > // --- Info --- > public static String ResourceInfo_readOnly; > public static String ResourceInfo_executable; >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.properties,v >retrieving revision 1.144 >diff -u -r1.144 plugin.properties >--- plugin.properties 23 Feb 2009 23:55:43 -0000 1.144 >+++ plugin.properties 4 Mar 2009 14:49:29 -0000 >@@ -219,6 +219,7 @@ > PreferenceKeywords.Restore = restore > PreferenceKeywords.State = state > PreferenceKeywords.Encoding = encoding >+PreferenceKeywords.RecentWorkspaces = workspaces prompt recent startup > > # TODO This stuff is just to help me work on the parsing of the menus extension > # point. It is likely not in its final form yet. >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/plugin.xml,v >retrieving revision 1.285 >diff -u -r1.285 plugin.xml >--- plugin.xml 23 Feb 2009 23:55:43 -0000 1.285 >+++ plugin.xml 4 Mar 2009 14:49:30 -0000 >@@ -411,6 +411,9 @@ > id="org.eclipse.ui.ide.startupAndShutdown" > label="%PreferenceKeywords.StartupAndShutdown"/> > <keyword >+ id="org.eclipse.ui.ide.recentWorkspaces" >+ label="%PreferenceKeywords.RecentWorkspaces"/> >+ <keyword > id="org.eclipse.ui.ide.workspace" > label="%PreferenceKeywords.Workspace"/> > <keyword >@@ -2234,7 +2237,7 @@ > type="org.eclipse.core.resources.IMarker"> > </propertyTester> > </extension> >- <extension >+ <extension > point="org.eclipse.ui.installationPages"> > <page > name="%installationPage.feature.name" >#P org.eclipse.ui.ide.application >Index: src/org/eclipse/ui/internal/ide/application/dialogs/IDEStartupPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/dialogs/IDEStartupPreferencePage.java,v >retrieving revision 1.2 >diff -u -r1.2 IDEStartupPreferencePage.java >--- src/org/eclipse/ui/internal/ide/application/dialogs/IDEStartupPreferencePage.java 16 Mar 2007 18:00:16 -0000 1.2 >+++ src/org/eclipse/ui/internal/ide/application/dialogs/IDEStartupPreferencePage.java 4 Mar 2009 14:49:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2007 IBM Corporation and others. >+ * Copyright (c) 2004, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Eric Rizzo - removed "prompt for workspace on startup" checkbox > *******************************************************************************/ > package org.eclipse.ui.internal.ide.application.dialogs; > >@@ -21,7 +22,6 @@ > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.internal.IWorkbenchHelpContextIds; > import org.eclipse.ui.internal.dialogs.StartupPreferencePage; >-import org.eclipse.ui.internal.ide.ChooseWorkspaceData; > import org.eclipse.ui.internal.ide.IDEInternalPreferences; > import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; > import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; >@@ -38,8 +38,6 @@ > > private Button refreshButton; > >- private Button launchPromptButton; >- > private Button exitPromptButton; > > /* >@@ -54,7 +52,6 @@ > > Composite composite = createComposite(parent); > >- createLaunchPromptPref(composite); > createRefreshWorkspaceOnStartupPref(composite); > createExitPromptPref(composite); > >@@ -72,8 +69,6 @@ > protected void performDefaults() { > IPreferenceStore store = getIDEPreferenceStore(); > >- launchPromptButton.setSelection(true); >- > refreshButton > .setSelection(store > .getDefaultBoolean(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP)); >@@ -94,14 +89,6 @@ > store.setValue(IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP, > refreshButton.getSelection()); > >- // TODO: This should get the value from the configuration preference >- // area, but dj said we shouldn't use it yet; some final details are >- // being worked out. Hopefully it will be available soon, at which time >- // the entire recentWorkspaces.xml file can be removed. But until then, >- // this preference reads/writes the file each time. >- ChooseWorkspaceData.setShowDialogValue(launchPromptButton >- .getSelection()); >- > // store the exit prompt on last window close setting > store.setValue(IDEInternalPreferences.EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, > exitPromptButton.getSelection()); >@@ -119,20 +106,6 @@ > IDEInternalPreferences.REFRESH_WORKSPACE_ON_STARTUP)); > } > >- protected void createLaunchPromptPref(Composite composite) { >- launchPromptButton = new Button(composite, SWT.CHECK); >- launchPromptButton.setText(IDEWorkbenchMessages.StartupPreferencePage_launchPromptButton); >- launchPromptButton.setFont(composite.getFont()); >- >- // TODO: This should get the value from the configuration preference >- // area, but dj said we shouldn't use it yet; some final details are >- // being worked out. Hopefully it will be available soon, at which time >- // the entire recentWorkspaces.xml file can be removed. But until then, >- // this preference reads/writes the file each time. >- launchPromptButton.setSelection(ChooseWorkspaceData >- .getShowDialogValue()); >- } >- > protected void createExitPromptPref(Composite composite) { > exitPromptButton = new Button(composite, SWT.CHECK); > exitPromptButton.setText(IDEWorkbenchMessages.StartupPreferencePage_exitPromptButton); >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/plugin.xml,v >retrieving revision 1.9 >diff -u -r1.9 plugin.xml >--- plugin.xml 19 Jan 2009 13:42:13 -0000 1.9 >+++ plugin.xml 4 Mar 2009 14:49:32 -0000 >@@ -19,6 +19,13 @@ > id="org.eclipse.ui.preferencePages.Startup"> > <keywordReference id="org.eclipse.ui.ide.startupAndShutdown"/> > </page> >+ <page >+ name="%PreferencePages.Startup.Workspaces" >+ category="org.eclipse.ui.preferencePages.Startup" >+ class="org.eclipse.ui.internal.ide.application.dialogs.RecentWorkspacesPreferencePage" >+ id="org.eclipse.ui.preferencePages.Startup.Workspaces"> >+ <keywordReference id="org.eclipse.ui.ide.recentWorkspaces"/> >+ </page> > </extension> > <extension > point="org.eclipse.ui.perspectives"> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/plugin.properties,v >retrieving revision 1.9 >diff -u -r1.9 plugin.properties >--- plugin.properties 19 Jan 2009 13:42:13 -0000 1.9 >+++ plugin.properties 4 Mar 2009 14:49:32 -0000 >@@ -12,6 +12,7 @@ > Plugin.providerName = Eclipse.org > > PreferencePages.Startup = Startup and Shutdown >+PreferencePages.Startup.Workspaces = Workspaces > > Perspective.resourcePerspective = Resource > Perspective.resourceDescription = This perspective is designed to provide general resource viewing and navigation. >Index: src/org/eclipse/ui/internal/ide/application/dialogs/RecentWorkspacesPreferencePage.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/ide/application/dialogs/RecentWorkspacesPreferencePage.java >diff -N src/org/eclipse/ui/internal/ide/application/dialogs/RecentWorkspacesPreferencePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/ide/application/dialogs/RecentWorkspacesPreferencePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,187 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Eric Rizzo and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Eric Rizzo - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.ide.application.dialogs; >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+ >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.jface.preference.PreferencePage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.List; >+import org.eclipse.swt.widgets.Spinner; >+import org.eclipse.ui.IWorkbench; >+import org.eclipse.ui.IWorkbenchPreferencePage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.IWorkbenchHelpContextIds; >+import org.eclipse.ui.internal.ide.ChooseWorkspaceData; >+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; >+ >+/** >+ * Preference page for editing the list of recent workspaces and whether or not >+ * the user is prompted at startup. >+ * >+ * @since 3.5 >+ */ >+public class RecentWorkspacesPreferencePage extends PreferencePage >+ implements IWorkbenchPreferencePage { >+ >+ private static final int MIN_WORKSPACS = 5; >+ private static final int MAX_WORKSPACES = 99; >+ private static final int MAX_WORKSPACES_DIGIT_COUNT = 2; >+ >+ private ChooseWorkspaceData workspacesData; >+ >+ private Button promptOption; >+ private Spinner maxWorkspacesField; >+ private List workspacesList; >+ private Button removeButton; >+ >+ >+ public void init(IWorkbench workbench) { >+ workspacesData = new ChooseWorkspaceData(Platform.getInstanceLocation().getURL()); >+ } >+ >+ public Control createContents(Composite parent) { >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, >+ IWorkbenchHelpContextIds.WORKSPACES_PREFERENCE_PAGE); >+ >+ Composite container = new Composite(parent, SWT.NULL); >+ final GridLayout gridLayout = new GridLayout(); >+ gridLayout.numColumns = 2; >+ gridLayout.marginHeight = 0; >+ gridLayout.marginWidth = 0; >+ container.setLayout(gridLayout); >+ >+ createPromptOption(container); >+ createMaxWorkspacesField(container); >+ createWorkspacesList(container); >+ >+ return container; >+ } >+ >+ >+ protected void createPromptOption(Composite parent) { >+ promptOption = new Button(parent, SWT.CHECK); >+ promptOption.setText(IDEWorkbenchMessages.RecentWorkspacesPreferencePage_PromptAtStartup_label); >+ promptOption.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); >+ >+ promptOption.setSelection(workspacesData.getShowDialog()); >+ promptOption.addSelectionListener(new SelectionAdapter(){ >+ public void widgetSelected(SelectionEvent event) { >+ workspacesData.toggleShowDialog(); >+ } >+ }); >+ } >+ >+ >+ protected void createMaxWorkspacesField(Composite parent) { >+ final Label maxWorkspacesLabel = new Label(parent, SWT.NONE); >+ maxWorkspacesLabel.setText(IDEWorkbenchMessages.RecentWorkspacesPreferencePage_NumberOfWorkspaces_label); >+ maxWorkspacesField = new Spinner(parent, SWT.BORDER); >+ maxWorkspacesField.setTextLimit(MAX_WORKSPACES_DIGIT_COUNT); >+ maxWorkspacesField.setMinimum(MIN_WORKSPACS); >+ maxWorkspacesField.setMaximum(MAX_WORKSPACES); >+ >+ maxWorkspacesField.setSelection(workspacesData.getRecentWorkspaces().length); >+ } >+ >+ >+ protected void createWorkspacesList(Composite parent) { >+ final Group recentWorkspacesGroup = new Group(parent, SWT.NONE); >+ recentWorkspacesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); >+ recentWorkspacesGroup.setText(IDEWorkbenchMessages.RecentWorkspacesPreferencePage_RecentWorkspacesList_label); >+ final GridLayout gridLayout_1 = new GridLayout(); >+ gridLayout_1.numColumns = 2; >+ recentWorkspacesGroup.setLayout(gridLayout_1); >+ >+ workspacesList = new List(recentWorkspacesGroup, SWT.BORDER | SWT.MULTI); >+ final GridData gd_workspacesList = new GridData(SWT.FILL, SWT.FILL, true, true); >+ workspacesList.setLayoutData(gd_workspacesList); >+ >+ removeButton = new Button(recentWorkspacesGroup, SWT.NONE); >+ final GridData gd_removeButton = new GridData(SWT.CENTER, SWT.TOP, false, false); >+ removeButton.setLayoutData(gd_removeButton); >+ removeButton.setText(IDEWorkbenchMessages.RecentWorkspacesPreferencePage_RemoveButton_label); >+ removeButton.setEnabled(false); >+ >+ removeButton.addSelectionListener(new SelectionAdapter(){ >+ public void widgetSelected(SelectionEvent event) { >+ removeSelectedWorkspaces(); >+ } >+ }); >+ >+ workspacesList.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent event) { >+ removeButton.setEnabled(workspacesList.getSelectionCount() > 0); >+ } >+ }); >+ >+ String[] recentWorkspaces = workspacesData.getRecentWorkspaces(); >+ for (int i = 0; i < recentWorkspaces.length; i++) { >+ String aWorkspace = recentWorkspaces[i]; >+ if (aWorkspace != null) { >+ workspacesList.add(aWorkspace); >+ } >+ } >+ } >+ >+ >+ protected void removeSelectedWorkspaces() { >+ // This would be a lot less code if we could use Jakarta CollectionUtils and/or ArrayUtils >+ >+ int[] selected = workspacesList.getSelectionIndices(); >+ java.util.List workspaces = new ArrayList(Arrays.asList(workspacesList.getItems())); >+ >+ // Iterate bottom-up because removal changes indices in the list >+ for (int i = selected.length-1; i >= 0; i--) { >+ workspaces.remove(selected[i]); >+ } >+ >+ String[] newItems = new String[workspaces.size()]; >+ workspaces.toArray(newItems); >+ workspacesList.setItems(newItems); >+ } >+ >+ >+ protected void performDefaults() { >+ promptOption.setSelection(true); >+ super.performDefaults(); >+ } >+ >+ >+ public boolean performOk() { >+ int maxWorkspaces = maxWorkspacesField.getSelection(); >+ String[] workspaces = new String[maxWorkspaces]; >+ String[] listItems = workspacesList.getItems(); >+ >+ if (maxWorkspaces < listItems.length) { >+ // TODO: maybe alert the user that the list will be truncated? >+ System.arraycopy(listItems, 0, workspaces, 0, maxWorkspaces); >+ } else { >+ System.arraycopy(listItems, 0, workspaces, 0, listItems.length); >+ } >+ >+ workspacesData.setRecentWorkspaces(workspaces); >+ workspacesData.writePersistedData(); >+ return true; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
pwebster
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 162102
:
126254
|
126255
|
126589
| 127480