Merge "Bug 422390 - [syntax coloring][regression] "Function declarations" setting broke anonymous function body coloring"
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 @@
}
- 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 @@
}
+ 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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
} else {
fSelectedWorkingSets= new IWorkingSet[0];
}
+ fShowOnlyJSWorkingSets = dialog.isShowOnlyJSWorkingSetsEnabled();
updateWorkingSetSelection();
}
}
@@ -298,6 +303,7 @@
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 @@
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 @@
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 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_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