/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
public class CustomFiltersDialog extends SelectionDialog {
private Stack fFilterDescriptorChangeHistory;
-
+
/**
* Creates a dialog to customize Java element filters.
- *
+ *
* @param shell the parent shell
* @param viewId the id of the view
* @param enablePatterns <code>true</code> if pattern filters are enabled
setTitle(FilterMessages.getString("CustomFiltersDialog.title")); //$NON-NLS-1$
setMessage(FilterMessages.getString("CustomFiltersDialog.filterList.label")); //$NON-NLS-1$
super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IJavaHelpContextIds.CUSTOM_FILTERS_DIALOG);
}
/**
* Overrides method in Dialog
- *
+ *
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
+ */
protected Control createDialogArea(Composite parent) {
initializeDialogUnits(parent);
// create a composite with standard margins and spacing
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setFont(parent.getFont());
Composite group= composite;
-
+
// Checkbox
fEnableUserDefinedPatterns= new Button(group, SWT.CHECK);
fEnableUserDefinedPatterns.setFocus();
fEnableUserDefinedPatterns.setText(FilterMessages.getString("CustomFiltersDialog.enableUserDefinedPattern")); //$NON-NLS-1$
-
+
// Pattern field
fUserDefinedPatterns= new Text(group, SWT.SINGLE | SWT.BORDER);
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
// Filters provided by extension point
if (fBuiltInFilters.length > 0)
createCheckBoxList(group);
-
- applyDialogFont(parent);
+
+ applyDialogFont(parent);
return parent;
}
private void createCheckBoxList(Composite parent) {
// Filler
new Label(parent, SWT.NONE);
-
+
Label info= new Label(parent, SWT.LEFT);
info.setText(FilterMessages.getString("CustomFiltersDialog.filterList.label")); //$NON-NLS-1$
-
+
fCheckBoxList= CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
GridData data= new GridData(GridData.FILL_BOTH);
data.heightHint= fCheckBoxList.getTable().getItemHeight() * 10;
fCheckBoxList.setInput(fBuiltInFilters);
setInitialSelections(getEnabledFilterDescriptors());
-
+
List initialSelection= getInitialElementSelections();
if (initialSelection != null && !initialSelection.isEmpty())
checkInitialSelections();
}
super.okPressed();
}
-
+
private ILabelProvider createLabelPrivder() {
- return
+ return
new LabelProvider() {
public Image getImage(Object element) {
return null;
}
// ---------- result handling ----------
-
+
protected void setResult(List newResult) {
super.setResult(newResult);
if (fUserDefinedPatterns.getText().length() > 0) {
} else {
fEnablePatterns= false;
fPatterns= new String[0];
- }
+ }
}
public boolean areUserDefinedPatternsEnabled() {
return fEnablePatterns;
}
-
+
/**
* @return a stack with the filter descriptor check history
* @since 3.0
}
return (String[])result.toArray(new String[result.size()]);
}
-
+
private static void addPattern(List list, String pattern) {
if (list.isEmpty())
list.add(pattern);
}
return strBuf.toString();
}
-
+
private static String escapeSeparator(String pattern, String separator) {
int length= pattern.length();
StringBuffer buf= new StringBuffer(length);
buf.append(ch);
}
return buf.toString();
-
+
}
}