summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvrubezhny2013-11-21 17:13:59 (EST)
committervrubezhny2013-11-21 17:28:51 (EST)
commit377d97267f084297dea8d6570d2f28167eda07d2 (patch)
treea8b0ad5709a4f6ea1df3ac2e568f1db537a047c7
parentc8c8d3c5ef286399cb2370d9ff2cad8da75d7329 (diff)
downloadwebtools.jsdt.core-377d97267f084297dea8d6570d2f28167eda07d2.zip
webtools.jsdt.core-377d97267f084297dea8d6570d2f28167eda07d2.tar.gz
webtools.jsdt.core-377d97267f084297dea8d6570d2f28167eda07d2.tar.bz2
Bug 324661 - [UI] No working sets are shown in the new project wizardrefs/changes/01/18701/1
The following changes are made to fix the issue: - The 'Working Set Selection' dialog is made to show all the Working Sets by default. - The 'Show Only JavaScript Working Sets' checkbox is added under the Working Sets list that allows a user to hide non-JavaScripts Working Sets (which actually JavaScripts ans Resource Working Sets). The option value is stored under the Dialog Settings as well as the Working Sets selection history. Signed-off-by: vrubezhny <vrubezhny@exadel.com>
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/SimpleWorkingSetSelectionDialog.java61
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java16
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.java3
-rw-r--r--bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.properties3
4 files changed, 72 insertions, 11 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/SimpleWorkingSetSelectionDialog.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/SimpleWorkingSetSelectionDialog.java
index cc0f7ee..79eba99 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/SimpleWorkingSetSelectionDialog.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/SimpleWorkingSetSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -92,13 +92,13 @@ public class SimpleWorkingSetSelectionDialog extends SelectionDialog {
}
- private class Filter extends ViewerFilter {
+ private static class Filter extends ViewerFilter {
public boolean select(Viewer viewer, Object parentElement, Object element) {
return isCompatible((IWorkingSet)element);
}
- private boolean isCompatible(IWorkingSet set) {
+ protected boolean isCompatible(IWorkingSet set) {
if (set.isAggregateWorkingSet() || !set.isSelfUpdating())
return false;
@@ -113,6 +113,31 @@ public class SimpleWorkingSetSelectionDialog extends SelectionDialog {
}
+ private static class JSFilter extends Filter {
+
+ private String[] jsWorkingSetIds = null;
+
+ public void setJSWorkingSetIds(String[] workingSetIds) {
+ jsWorkingSetIds = workingSetIds;
+ }
+
+ protected boolean isCompatible(IWorkingSet set) {
+ if (!super.isCompatible(set))
+ return false;
+
+ for (int i = 0; jsWorkingSetIds != null && i < jsWorkingSetIds.length; i++) {
+ if (jsWorkingSetIds[i].equals(set.getId()))
+ return true;
+ }
+
+ return false;
+ }
+
+ }
+
+ private static final Filter[] ALL_WORKINGSETS = {new Filter()};
+ private static final JSFilter[] JS_ONLY_WORKINGSETS = {new JSFilter()};
+
private final IWorkingSet[] fWorkingSets;
private final IWorkingSet[] fInitialSelection;
private final ArrayList fCreatedWorkingSets;
@@ -120,21 +145,31 @@ public class SimpleWorkingSetSelectionDialog extends SelectionDialog {
private CheckboxTableViewer fTableViewer;
private IWorkingSet[] fCheckedElements;
+ private boolean fShowOnlyJSEnabled;
+
private Button fSelectAll;
private Button fDeselectAll;
private Button fNewWorkingSet;
+
+ private Button fShowOnlyJSWorkingSets;
public SimpleWorkingSetSelectionDialog(Shell shell, String[] workingSetIds, IWorkingSet[] initialSelection) {
+ this(shell, workingSetIds, initialSelection, false);
+ }
+
+ public SimpleWorkingSetSelectionDialog(Shell shell, String[] workingSetIds, IWorkingSet[] initialSelection, boolean showOnlyJSEnabled) {
super(shell);
setTitle(WorkingSetMessages.SimpleWorkingSetSelectionDialog_SimpleSelectWorkingSetDialog_title);
setHelpAvailable(false);
setShellStyle(getShellStyle() | SWT.RESIZE);
- fWorkingSets= WorkingSetConfigurationBlock.filter(PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets(), workingSetIds);
+ JS_ONLY_WORKINGSETS[0].setJSWorkingSetIds(workingSetIds);
+ fWorkingSets= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
fInitialSelection= initialSelection;
fCheckedElements= fInitialSelection;
fCreatedWorkingSets= new ArrayList();
+ fShowOnlyJSEnabled = showOnlyJSEnabled;
}
protected final Control createDialogArea(Composite parent) {
@@ -160,6 +195,20 @@ public class SimpleWorkingSetSelectionDialog extends SelectionDialog {
tableComposite.setLayout(layout);
fTableViewer= createTableViewer(tableComposite);
+ fTableViewer.setFilters(fShowOnlyJSEnabled ? JS_ONLY_WORKINGSETS : ALL_WORKINGSETS);
+
+ fShowOnlyJSWorkingSets= new Button(composite, SWT.CHECK);
+ fShowOnlyJSWorkingSets.setText(WorkingSetMessages.SimpleWorkingSetSelectionDialog_show_only_js_working_sets_button);
+ fShowOnlyJSWorkingSets.setLayoutData(new GridData(SWT.LEAD, SWT.CENTER, true, false));
+ fShowOnlyJSWorkingSets.setSelection(fShowOnlyJSEnabled);
+ fShowOnlyJSWorkingSets.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fShowOnlyJSEnabled= fShowOnlyJSWorkingSets.getSelection();
+ fTableViewer.setFilters(fShowOnlyJSEnabled ? JS_ONLY_WORKINGSETS : ALL_WORKINGSETS);
+ checkedStateChanged();
+ }
+ });
+
createRightButtonBar(inner);
createBottomButtonBar(composite);
@@ -171,6 +220,10 @@ public class SimpleWorkingSetSelectionDialog extends SelectionDialog {
return fCheckedElements;
}
+ public boolean isShowOnlyJSWorkingSetsEnabled() {
+ return fShowOnlyJSEnabled;
+ }
+
protected CheckboxTableViewer createTableViewer(Composite parent) {
CheckboxTableViewer result= CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI);
result.addCheckStateListener(new ICheckStateListener() {
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java
index 28f414f..f3425d5 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetConfigurationBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -142,6 +142,7 @@ public class WorkingSetConfigurationBlock {
}
private static final String WORKINGSET_SELECTION_HISTORY= "workingset_selection_history"; //$NON-NLS-1$
+ private static final String SHOW_ONLY_JS_WORKINGSETS_HISTORY= "show_only_js_workingsets_history"; //$NON-NLS-1$
private static final int MAX_HISTORY_SIZE= 5;
private Label fLabel;
@@ -151,6 +152,7 @@ public class WorkingSetConfigurationBlock {
private String fMessage;
private Button fEnableButton;
private ArrayList fSelectionHistory;
+ private boolean fShowOnlyJSWorkingSets;
private final IDialogSettings fSettings;
private final String fEnableButtonText;
private final String[] fWorkingSetIds;
@@ -169,7 +171,8 @@ public class WorkingSetConfigurationBlock {
fEnableButtonText= enableButtonText;
fSelectedWorkingSets= new IWorkingSet[0];
fSettings= settings;
- fSelectionHistory= loadSelectionHistory(settings, workingSetIds);
+ fShowOnlyJSWorkingSets= settings.getBoolean(SHOW_ONLY_JS_WORKINGSETS_HISTORY);
+ fSelectionHistory= loadSelectionHistory(settings, workingSetIds, fShowOnlyJSWorkingSets);
}
/**
@@ -238,7 +241,8 @@ public class WorkingSetConfigurationBlock {
fConfigure.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- SimpleWorkingSetSelectionDialog dialog= new SimpleWorkingSetSelectionDialog(parent.getShell(), fWorkingSetIds, fSelectedWorkingSets);
+ boolean showOnlyJSWorkingSets = fSettings.getBoolean(SHOW_ONLY_JS_WORKINGSETS_HISTORY);
+ SimpleWorkingSetSelectionDialog dialog= new SimpleWorkingSetSelectionDialog(parent.getShell(), fWorkingSetIds, fSelectedWorkingSets, showOnlyJSWorkingSets);
if (fMessage != null)
dialog.setMessage(fMessage);
@@ -250,6 +254,7 @@ public class WorkingSetConfigurationBlock {
} else {
fSelectedWorkingSets= new IWorkingSet[0];
}
+ fShowOnlyJSWorkingSets = dialog.isShowOnlyJSWorkingSetsEnabled();
updateWorkingSetSelection();
}
}
@@ -298,6 +303,7 @@ public class WorkingSetConfigurationBlock {
String currentSelection= buf.toString();
int index= historyIndex(currentSelection);
historyInsert(currentSelection);
+ fSettings.put(SHOW_ONLY_JS_WORKINGSETS_HISTORY, fShowOnlyJSWorkingSets);
if (index >= 0) {
fWorkingSetCombo.select(index);
} else {
@@ -359,7 +365,7 @@ public class WorkingSetConfigurationBlock {
settings.put(WORKINGSET_SELECTION_HISTORY, history);
}
- private ArrayList loadSelectionHistory(IDialogSettings settings, String[] workingSetIds) {
+ private ArrayList loadSelectionHistory(IDialogSettings settings, String[] workingSetIds, boolean showOnlyJSWorkingSets) {
String[] strings= settings.getArray(WORKINGSET_SELECTION_HISTORY);
if (strings == null || strings.length == 0)
return new ArrayList();
@@ -377,7 +383,7 @@ public class WorkingSetConfigurationBlock {
if (workingSet == null) {
valid= false;
} else {
- if (!workingSetIdsSet.contains(workingSet.getId()))
+ if (showOnlyJSWorkingSets && !workingSetIdsSet.contains(workingSet.getId()))
valid= false;
}
}
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.java
index e74c0f5..f52335a 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
@@ -59,6 +59,7 @@ public final class WorkingSetMessages extends NLS {
public static String SimpleWorkingSetSelectionDialog_DeselectAll_button;
public static String SimpleWorkingSetSelectionDialog_New_button;
public static String SimpleWorkingSetSelectionDialog_SelectAll_button;
+ public static String SimpleWorkingSetSelectionDialog_show_only_js_working_sets_button;
public static String SimpleWorkingSetSelectionDialog_SimpleSelectWorkingSetDialog_title;
public static String ViewActionGroup_show_label;
public static String ViewActionGroup_projects_label;
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.properties b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.properties
index d9cce21..fe562ff 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.properties
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2011 IBM Corporation and others.
+# Copyright (c) 2000, 2013 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
@@ -73,6 +73,7 @@ SimpleWorkingSetSelectionDialog_SimpleSelectWorkingSetDialog_title=Working Set S
SimpleWorkingSetSelectionDialog_SelectAll_button=Select &All
SimpleWorkingSetSelectionDialog_New_button=&New...
SimpleWorkingSetSelectionDialog_DeselectAll_button=&Deselect All
+SimpleWorkingSetSelectionDialog_show_only_js_working_sets_button=Show Only JavaScript Working Sets
ConfigureWorkingSetAssignementAction_OnlyShowVisible_link=Show &only <a>Script Explorer working sets</a>
ConfigureWorkingSetAssignementAction_WorkingSets_actionLabel=&Assign Working Sets...
ConfigureWorkingSetAssignementAction_WorkingSetAssignments_title=Working Set Assignments