configure project specific preferences only for the projects with the same nature
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/PropertyAndPreferencePage.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/PropertyAndPreferencePage.java
index 0b95c0b..791650a 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/PropertyAndPreferencePage.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/internal/ui/preferences/PropertyAndPreferencePage.java
@@ -88,6 +88,10 @@
return getPropertyPageId() != null;
}
+ protected String getNatureId() {
+ return null;
+ }
+
protected boolean offerLink() {
return fData == null || !Boolean.TRUE.equals(fData.get(DATA_NO_LINK));
}
@@ -223,7 +227,7 @@
// ignore
}
ProjectSelectionDialog dialog = new ProjectSelectionDialog(
- getShell(), projectsWithSpecifics);
+ getShell(), projectsWithSpecifics, getNatureId());
if (dialog.open() == Window.OK) {
IScriptProject res = (IScriptProject) dialog.getFirstResult();
openProjectProperties(res.getProject(), data);
diff --git a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
index b6a9694..7b81173 100644
--- a/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
+++ b/core/plugins/org.eclipse.dltk.ui/src/org/eclipse/dltk/ui/dialogs/ProjectSelectionDialog.java
@@ -6,6 +6,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IScriptModel;
+import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.internal.ui.ModelElementComparator;
import org.eclipse.dltk.internal.ui.StandardModelElementContentProvider;
import org.eclipse.dltk.internal.ui.dialogs.StatusInfo;
@@ -38,6 +39,7 @@
// the visual selection widget group
private TableViewer fTableViewer;
private Set fProjectsWithSpecifics;
+ private final String natureId;
// sizing constants
private final static int SIZING_SELECTION_WIDGET_HEIGHT= 250;
@@ -48,7 +50,13 @@
private ViewerFilter fFilter;
public ProjectSelectionDialog(Shell parentShell, Set projectsWithSpecifics) {
+ this(parentShell, projectsWithSpecifics, null);
+ }
+
+ public ProjectSelectionDialog(Shell parentShell, Set projectsWithSpecifics,
+ String natureId) {
super(parentShell);
+ this.natureId = natureId;
setTitle(PreferencesMessages.ProjectSelectionDialog_title);
setMessage(PreferencesMessages.ProjectSelectionDialog_desciption);
fProjectsWithSpecifics= projectsWithSpecifics;
@@ -93,6 +101,19 @@
fTableViewer.setContentProvider(new StandardModelElementContentProvider());
fTableViewer.setComparator(new ModelElementComparator());
fTableViewer.getControl().setFont(font);
+ if (natureId != null) {
+ fTableViewer.addFilter(new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (element instanceof IScriptProject) {
+ IScriptProject project = (IScriptProject) element;
+ return natureId.equals(project.getLanguageToolkit()
+ .getNatureId());
+ }
+ return true;
+ }
+ });
+ }
Button checkbox= new Button(composite, SWT.CHECK);
checkbox.setText(PreferencesMessages.ProjectSelectionDialog_filter);