Skip to content

Commit 4a34e1c

Browse files
pramhegdeBeckerWdf
authored andcommitted
Window Title: Add preference to show/hide editor tooltip part
The workbench window title can currently be customized to display workspace name, perspective name, full path and product name. The active editor name is shown as a part of the window title but is not customizable in the preferences page. This change makes the active editor info customizable.
1 parent 579b936 commit 4a34e1c

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchWindowAdvisor.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ public void partInputChanged(IWorkbenchPartReference ref) {
358358
|| IDEInternalPreferences.SHOW_LOCATION.equals(property)
359359
|| IDEInternalPreferences.SHOW_LOCATION_NAME.equals(property)
360360
|| IDEInternalPreferences.SHOW_PERSPECTIVE_IN_TITLE.equals(property)
361-
|| IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE.equals(property)) {
361+
|| IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE.equals(property)
362+
|| IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE.equals(property)) {
362363
// Make sure the title is actually updated by
363364
// setting last active page.
364365
lastActivePage = null;
@@ -398,9 +399,11 @@ private String computeTitle() {
398399
}
399400

400401
// active editor
401-
if (currentPage != null) {
402-
if (activeEditor != null) {
403-
sj.add(activeEditor.getTitleToolTip());
402+
if (ps.getBoolean(IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE)) {
403+
if (currentPage != null) {
404+
if (activeEditor != null) {
405+
sj.add(activeEditor.getTitleToolTip());
406+
}
404407
}
405408
}
406409

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEInternalPreferences.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ public interface IDEInternalPreferences {
133133
*/
134134
String SHOW_PRODUCT_IN_TITLE = "SHOW_PRODUCT_IN_TITLE"; //$NON-NLS-1$
135135

136+
/**
137+
* Whether to show the active editor information in the window title.
138+
*/
139+
String SHOW_ACTIVE_EDITOR_INFO_IN_TITLE = "SHOW_ACTIVE_EDITOR_INFO_IN_TITLE"; //$NON-NLS-1$
140+
136141
/**
137142
* System explore command, used to launch file manager showing selected
138143
* resource.

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEPreferenceInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void initializeDefaultPreferences() {
8888
node.putBoolean(IDEInternalPreferences.SHOW_LOCATION_NAME, true);
8989
node.putBoolean(IDEInternalPreferences.SHOW_PERSPECTIVE_IN_TITLE, false);
9090
node.putBoolean(IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE, true);
91+
node.putBoolean(IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE, true);
9192

9293
// by default, don't start hidden problems view to show decoration on
9394
// it's icon. See bug 513901

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ public class IDEWorkbenchMessages extends NLS {
570570
public static String IDEWorkspacePreference_showLocationNameInWindowTitle;
571571
public static String IDEWorkspacePreference_showPerspectiveNameInWindowTitle;
572572
public static String IDEWorkspacePreference_showProductNameInWindowTitle;
573+
public static String IDEWorkspacePreference_showActiveEditorInfoInWindowTitle;
573574
public static String IDEWorkspacePreference_showLocationSetOnCommandLine;
574575
public static String IDEWorkspacePreference_workspaceName;
575576
public static String IDEWorkbenchPreference_workbenchSystemExplorer;

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/IDEWorkspacePreferencePage.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public class IDEWorkspacePreferencePage extends PreferencePage implements IWorkb
9393

9494
private Button showProductNameInTitle;
9595

96+
private Button showActiveEditorInfoInTitle;
97+
9698
private Button autoRefreshButton;
9799

98100
private Button lightweightRefreshButton;
@@ -260,6 +262,7 @@ private void createWorkspaceLocationGroup(Composite composite) {
260262
boolean isShowPerspective = getIDEPreferenceStore()
261263
.getBoolean(IDEInternalPreferences.SHOW_PERSPECTIVE_IN_TITLE);
262264
boolean isShowProduct = getIDEPreferenceStore().getBoolean(IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE);
265+
boolean isShowActiveEditorInfo = getIDEPreferenceStore().getBoolean(IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE);
263266

264267
Composite groupComposite = new Composite(composite, SWT.LEFT);
265268
GridDataFactory.fillDefaults().grab(true, false).applyTo(groupComposite);
@@ -314,6 +317,10 @@ private void createWorkspaceLocationGroup(Composite composite) {
314317
showProductNameInTitle.setText(IDEWorkbenchMessages.IDEWorkspacePreference_showProductNameInWindowTitle);
315318
showProductNameInTitle.setSelection(isShowProduct);
316319

320+
showActiveEditorInfoInTitle = new Button(grpWindowTitle, SWT.CHECK);
321+
showActiveEditorInfoInTitle.setText(IDEWorkbenchMessages.IDEWorkspacePreference_showActiveEditorInfoInWindowTitle);
322+
showActiveEditorInfoInTitle.setSelection(isShowActiveEditorInfo);
323+
317324
// disable location component if -showlocation forced
318325
if (showLocationIsSetOnCommandLine) {
319326
Stream.of(showLocationPathInTitle, workspacePath).forEach(c -> {
@@ -528,9 +535,12 @@ protected void performDefaults() {
528535
boolean showLocationName = store.getDefaultBoolean(IDEInternalPreferences.SHOW_LOCATION_NAME);
529536
boolean showPerspectiveName = store.getDefaultBoolean(IDEInternalPreferences.SHOW_PERSPECTIVE_IN_TITLE);
530537
boolean showProductName = store.getDefaultBoolean(IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE);
538+
boolean showActiveEditorInfo = store.getDefaultBoolean(IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE);
531539
showLocationNameInTitle.setSelection(showLocationName);
532540
showPerspectiveNameInTitle.setSelection(showPerspectiveName);
533541
showProductNameInTitle.setSelection(showProductName);
542+
this.showActiveEditorInfoInTitle.setSelection(showActiveEditorInfo);
543+
534544
workspaceName.loadDefault();
535545

536546
boolean closeUnrelatedProj = store.getDefaultBoolean(IDEInternalPreferences.CLOSE_UNRELATED_PROJECTS);
@@ -594,6 +604,7 @@ public boolean performOk() {
594604
store.setValue(IDEInternalPreferences.SHOW_LOCATION_NAME, showLocationNameInTitle.getSelection());
595605
store.setValue(IDEInternalPreferences.SHOW_PERSPECTIVE_IN_TITLE, showPerspectiveNameInTitle.getSelection());
596606
store.setValue(IDEInternalPreferences.SHOW_PRODUCT_IN_TITLE, showProductNameInTitle.getSelection());
607+
store.setValue(IDEInternalPreferences.SHOW_ACTIVE_EDITOR_INFO_IN_TITLE, showActiveEditorInfoInTitle.getSelection());
597608

598609
workspaceName.store();
599610

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ IDEWorkspacePreference_showLocationInWindowTitle_lockedByCommandLine=This settin
547547
IDEWorkspacePreference_showLocationNameInWindowTitle=Show workspace nam&e:
548548
IDEWorkspacePreference_showPerspectiveNameInWindowTitle=Show perspec&tive name
549549
IDEWorkspacePreference_showProductNameInWindowTitle=Show product name
550+
IDEWorkspacePreference_showActiveEditorInfoInWindowTitle=Show active editor name
550551
IDEWorkspacePreference_showLocationSetOnCommandLine=Cannot modify, instance launched with -showLocation
551552
IDEWorkspacePreference_workspaceName=Wor&kspace name:
552553
IDEWorkbenchPreference_workbenchSystemExplorer=Command for launching system e&xplorer:

0 commit comments

Comments
 (0)