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 157641 Details for
Bug 284447
[Workbench] Add custom workspace name in front of the Workbench window title
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]
Implements a workspace preference for a workspace name
284447.txt (text/plain), 10.84 KB, created by
Markus Schorn
on 2010-01-29 11:41:45 EST
(
hide
)
Description:
Implements a workspace preference for a workspace name
Filename:
MIME Type:
Creator:
Markus Schorn
Created:
2010-01-29 11:41:45 EST
Size:
10.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/IDEInternalPreferences.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEInternalPreferences.java,v >retrieving revision 1.23 >diff -u -r1.23 IDEInternalPreferences.java >--- src/org/eclipse/ui/internal/ide/IDEInternalPreferences.java 20 Nov 2009 19:57:32 -0000 1.23 >+++ src/org/eclipse/ui/internal/ide/IDEInternalPreferences.java 29 Jan 2010 16:38:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -8,6 +8,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Dina Sayed, dsayed@eg.ibm.com, IBM - bug 269844 >+ * Markus Schorn (Wind River Systems) - bug 284447 > *******************************************************************************/ > > package org.eclipse.ui.internal.ide; >@@ -99,4 +100,9 @@ > > // Always show this import window > public static final String IMPORT_FILES_AND_FOLDERS_SHOW_DIALOG = "IMPORT_FILES_AND_FOLDERS_SHOW_DIALOG"; //$NON-NLS-1$ >+ >+ /** >+ * Workspace name, will be displayed in the window title. >+ */ >+ public static final String WORKSPACE_NAME = "WORKSPACE_NAME"; //$NON-NLS-1$ > } >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.69 >diff -u -r1.69 IDEWorkbenchMessages.java >--- src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 9 Dec 2009 22:14:59 -0000 1.69 >+++ src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java 29 Jan 2010 16:38:08 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2009 IBM Corporation and others. >+ * Copyright (c) 2005, 2010 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 >@@ -486,6 +486,7 @@ > public static String IDEWorkspacePreference_relatedLink; > public static String IDEWorkspacePreference_openReferencedProjects; > public static String IDEWorkspacePreference_closeUnrelatedProjectsToolTip; >+ public static String IDEWorkspacePreference_workspaceName; > > // --- Linked Resources --- > public static String LinkedResourcesPreference_explanation; >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.180 >diff -u -r1.180 messages.properties >--- src/org/eclipse/ui/internal/ide/messages.properties 9 Dec 2009 22:14:59 -0000 1.180 >+++ src/org/eclipse/ui/internal/ide/messages.properties 29 Jan 2010 16:38:09 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2009 IBM Corporation and others. >+# Copyright (c) 2000, 2010 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 >@@ -476,6 +476,7 @@ > IDEWorkspacePreference_relatedLink = See <a>''{0}''</a> for workspace startup and shutdown preferences. > IDEWorkspacePreference_openReferencedProjects = Open referenced projects when a project is opened > IDEWorkspacePreference_closeUnrelatedProjectsToolTip = Close unrelated projects without prompt >+IDEWorkspacePreference_workspaceName=Workspace name (shown in window title): > > # --- Linked Resources --- > LinkedResourcesPreference_explanation = Path variables specify locations in the file system. The locations of linked resources\nmay be specified relative to these path variables. >Index: src/org/eclipse/ui/internal/ide/dialogs/IDEWorkspacePreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/IDEWorkspacePreferencePage.java,v >retrieving revision 1.9 >diff -u -r1.9 IDEWorkspacePreferencePage.java >--- src/org/eclipse/ui/internal/ide/dialogs/IDEWorkspacePreferencePage.java 28 Aug 2009 15:24:35 -0000 1.9 >+++ src/org/eclipse/ui/internal/ide/dialogs/IDEWorkspacePreferencePage.java 29 Jan 2010 16:38:09 -0000 >@@ -1,5 +1,5 @@ > /**************************************************************************** >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 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 >@@ -8,6 +8,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Dina Sayed, dsayed@eg.ibm.com, IBM - bug 269844 >+ * Markus Schorn (Wind River Systems) - bug 284447 > *******************************************************************************/ > package org.eclipse.ui.internal.ide.dialogs; > >@@ -63,6 +64,8 @@ > > private IntegerFieldEditor saveInterval; > >+ private FieldEditor workspaceName; >+ > private Button autoRefreshButton; > > private Button closeUnrelatedProjectButton; >@@ -76,6 +79,7 @@ > > private RadioGroupFieldEditor openReferencesEditor; > >+ > /* > * (non-Javadoc) > * >@@ -105,6 +109,7 @@ > > createSpace(composite); > createSaveIntervalGroup(composite); >+ createWindowTitleGroup(composite); > createSpace(composite); > > createOpenPrefControls(composite); >@@ -217,7 +222,32 @@ > }); > > } >- >+ >+ /** >+ * Create a composite that contains entry fields specifying the workspace name >+ * preference. >+ * >+ * @param composite the Composite the group is created in. >+ */ >+ private void createWindowTitleGroup(Composite composite) { >+ Composite groupComposite = new Composite(composite, SWT.LEFT); >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 2; >+ groupComposite.setLayout(layout); >+ GridData gd = new GridData(); >+ gd.horizontalAlignment = GridData.FILL; >+ gd.grabExcessHorizontalSpace = true; >+ groupComposite.setLayoutData(gd); >+ >+ workspaceName = new StringFieldEditor( >+ IDEInternalPreferences.WORKSPACE_NAME, IDEWorkbenchMessages.IDEWorkspacePreference_workspaceName, >+ groupComposite); >+ >+ workspaceName.setPreferenceStore(getIDEPreferenceStore()); >+ workspaceName.load(); >+ workspaceName.setPage(this); >+ } >+ > /** > * Create the Refresh controls > * >@@ -345,6 +375,7 @@ > .setSelection(store > .getDefaultBoolean(IDEInternalPreferences.SAVE_ALL_BEFORE_BUILD)); > saveInterval.loadDefault(); >+ workspaceName.loadDefault(); > > boolean closeUnrelatedProj = store.getDefaultBoolean(IDEInternalPreferences.CLOSE_UNRELATED_PROJECTS); > closeUnrelatedProjectButton.setSelection(closeUnrelatedProj); >@@ -413,6 +444,8 @@ > } > } > >+ workspaceName.store(); >+ > Preferences preferences = ResourcesPlugin.getPlugin() > .getPluginPreferences(); > >#P org.eclipse.ui.ide.application >Index: src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java,v >retrieving revision 1.10 >diff -u -r1.10 IDEWorkbenchWindowAdvisor.java >--- src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java 25 May 2009 20:51:57 -0000 1.10 >+++ src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java 29 Jan 2010 16:38:10 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2009 IBM Corporation and others. >+ * Copyright (c) 2005, 2010 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 >+ * Markus Schorn (Wind River Systems) - bug 284447 > *******************************************************************************/ > package org.eclipse.ui.internal.ide.application; > >@@ -27,6 +28,8 @@ > import org.eclipse.jface.dialogs.MessageDialogWithToggle; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.resource.JFaceResources; >+import org.eclipse.jface.util.IPropertyChangeListener; >+import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.dnd.FileTransfer; >@@ -101,7 +104,6 @@ > }; > > private IAdaptable lastInput; >- > private IWorkbenchAction openPerspectiveAction; > > /** >@@ -297,6 +299,18 @@ > // do nothing > } > }); >+ >+ // Listen for changes of the workspace name. >+ IDEWorkbenchPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( >+ new IPropertyChangeListener() { >+ public void propertyChange(PropertyChangeEvent event) { >+ if (IDEInternalPreferences.WORKSPACE_NAME.equals(event.getProperty())) { >+ // Make sure the title is actually updated by setting last active page. >+ lastActivePage= null; >+ updateTitle(false); >+ } >+ } >+ }); > } > > private String computeTitle() { >@@ -344,6 +358,13 @@ > title = NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, > title, workspaceLocation); > } >+ >+ // Bug 284447: Prepend workspace name to the title >+ String workspaceName = IDEWorkbenchPlugin.getDefault().getPreferenceStore().getString( >+ IDEInternalPreferences.WORKSPACE_NAME); >+ if (workspaceName != null && workspaceName.length() > 0) { >+ title= NLS.bind(IDEWorkbenchMessages.WorkbenchWindow_shellTitle, workspaceName, title); >+ } > > return title; > }
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 284447
:
148038
| 157641