|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 7-34
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Simon Muschel <smuschel@gmx.de> - bug 247265 |
| 10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 11 |
package org.eclipse.pde.internal.ui.wizards.feature; |
12 |
package org.eclipse.pde.internal.ui.wizards.feature; |
| 12 |
|
13 |
|
| 13 |
import com.ibm.icu.text.Collator; |
14 |
import com.ibm.icu.text.Collator; |
| 14 |
import java.util.TreeSet; |
15 |
import java.util.TreeSet; |
|
|
16 |
import java.util.regex.Pattern; |
| 17 |
import java.util.regex.PatternSyntaxException; |
| 15 |
import org.eclipse.core.runtime.CoreException; |
18 |
import org.eclipse.core.runtime.CoreException; |
| 16 |
import org.eclipse.debug.core.*; |
19 |
import org.eclipse.debug.core.*; |
| 17 |
import org.eclipse.debug.ui.DebugUITools; |
20 |
import org.eclipse.debug.ui.DebugUITools; |
| 18 |
import org.eclipse.jface.dialogs.Dialog; |
21 |
import org.eclipse.jface.dialogs.Dialog; |
| 19 |
import org.eclipse.jface.dialogs.IDialogSettings; |
22 |
import org.eclipse.jface.dialogs.IDialogSettings; |
| 20 |
import org.eclipse.jface.viewers.CheckboxTableViewer; |
23 |
import org.eclipse.jface.viewers.*; |
| 21 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
|
|
| 22 |
import org.eclipse.pde.core.plugin.*; |
24 |
import org.eclipse.pde.core.plugin.*; |
| 23 |
import org.eclipse.pde.internal.core.PDECore; |
25 |
import org.eclipse.pde.internal.core.PDECore; |
|
|
26 |
import org.eclipse.pde.internal.core.util.PatternConstructor; |
| 24 |
import org.eclipse.pde.internal.ui.*; |
27 |
import org.eclipse.pde.internal.ui.*; |
| 25 |
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider; |
28 |
import org.eclipse.pde.internal.ui.elements.DefaultContentProvider; |
| 26 |
import org.eclipse.pde.internal.ui.wizards.ListUtil; |
29 |
import org.eclipse.pde.internal.ui.wizards.ListUtil; |
| 27 |
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut; |
30 |
import org.eclipse.pde.ui.launcher.EclipseLaunchShortcut; |
| 28 |
import org.eclipse.pde.ui.launcher.IPDELauncherConstants; |
31 |
import org.eclipse.pde.ui.launcher.IPDELauncherConstants; |
| 29 |
import org.eclipse.swt.SWT; |
32 |
import org.eclipse.swt.SWT; |
| 30 |
import org.eclipse.swt.events.SelectionAdapter; |
33 |
import org.eclipse.swt.events.*; |
| 31 |
import org.eclipse.swt.events.SelectionEvent; |
|
|
| 32 |
import org.eclipse.swt.layout.GridData; |
34 |
import org.eclipse.swt.layout.GridData; |
| 33 |
import org.eclipse.swt.layout.GridLayout; |
35 |
import org.eclipse.swt.layout.GridLayout; |
| 34 |
import org.eclipse.swt.widgets.*; |
36 |
import org.eclipse.swt.widgets.*; |
|
Lines 43-55
Link Here
|
| 43 |
|
45 |
|
| 44 |
private Combo fLaunchConfigsCombo; |
46 |
private Combo fLaunchConfigsCombo; |
| 45 |
private Button fInitLaunchConfigButton; |
47 |
private Button fInitLaunchConfigButton; |
|
|
48 |
private CheckboxTableViewer fPluginViewer; |
| 49 |
private Text fFilterText; |
| 46 |
|
50 |
|
| 47 |
private static final String S_INIT_LAUNCH = "initLaunch"; //$NON-NLS-1$ |
51 |
private static final String S_INIT_LAUNCH = "initLaunch"; //$NON-NLS-1$ |
| 48 |
|
52 |
|
|
|
53 |
class PluginFilter extends ViewerFilter { |
| 54 |
private String wMatch = "*"; //$NON-NLS-1$ |
| 55 |
|
| 56 |
public void setMatchText(String match) { |
| 57 |
if (match.indexOf("*") != 0 & match.indexOf("?") != 0 & match.indexOf(".") != 0) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 58 |
match = "*" + match; //$NON-NLS-1$ |
| 59 |
} |
| 60 |
wMatch = match + "*"; //$NON-NLS-1$ |
| 61 |
} |
| 62 |
|
| 63 |
public boolean select(Viewer viewer, Object parentElement, Object element) { |
| 64 |
if (element instanceof IPluginModelBase) { |
| 65 |
IPluginModelBase model = (IPluginModelBase) element; |
| 66 |
String id = model.getPluginBase().getId(); |
| 67 |
Pattern pattern = null; |
| 68 |
try { |
| 69 |
pattern = PatternConstructor.createPattern(wMatch, false); |
| 70 |
} catch (PatternSyntaxException e) { |
| 71 |
return true; |
| 72 |
} |
| 73 |
return pattern != null && pattern.matcher(id.subSequence(0, id.length())).matches(); |
| 74 |
} |
| 75 |
return true; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
private PluginFilter fPluginFilter; |
| 80 |
|
| 49 |
public PluginListPage() { |
81 |
public PluginListPage() { |
| 50 |
super("pluginListPage"); //$NON-NLS-1$ |
82 |
super("pluginListPage"); //$NON-NLS-1$ |
| 51 |
setTitle(PDEUIMessages.NewFeatureWizard_PlugPage_title); |
83 |
setTitle(PDEUIMessages.NewFeatureWizard_PlugPage_title); |
| 52 |
setDescription(PDEUIMessages.NewFeatureWizard_PlugPage_desc); |
84 |
setDescription(PDEUIMessages.NewFeatureWizard_PlugPage_desc); |
|
|
85 |
fPluginFilter = new PluginFilter(); |
| 53 |
} |
86 |
} |
| 54 |
|
87 |
|
| 55 |
public void createControl(Composite parent) { |
88 |
public void createControl(Composite parent) { |
|
Lines 95-105
Link Here
|
| 95 |
initPluginsButton.setSelection(!initLaunch); |
128 |
initPluginsButton.setSelection(!initLaunch); |
| 96 |
} |
129 |
} |
| 97 |
|
130 |
|
|
|
131 |
Composite labelContainer = new Composite(container, SWT.NONE); |
| 132 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
| 133 |
gd.horizontalSpan = 3; |
| 134 |
gd.horizontalIndent = 30; |
| 135 |
gd.widthHint = 300; |
| 136 |
labelContainer.setLayoutData(gd); |
| 137 |
layout = new GridLayout(2, false); |
| 138 |
layout.marginHeight = layout.marginWidth = 0; |
| 139 |
labelContainer.setLayout(layout); |
| 140 |
|
| 141 |
Label filterLabel = new Label(labelContainer, SWT.NONE); |
| 142 |
filterLabel.setText(PDEUIMessages.PluginListPage_pluginFilter); |
| 143 |
gd = new GridData(); |
| 144 |
gd.verticalAlignment = GridData.CENTER; |
| 145 |
filterLabel.setLayoutData(gd); |
| 146 |
fFilterText = new Text(labelContainer, SWT.BORDER); |
| 147 |
fFilterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| 148 |
fFilterText.addModifyListener(new ModifyListener() { |
| 149 |
public void modifyText(ModifyEvent e) { |
| 150 |
fPluginFilter.setMatchText(fFilterText.getText()); |
| 151 |
fPluginViewer.refresh(); |
| 152 |
} |
| 153 |
}); |
| 154 |
fFilterText.addKeyListener(new KeyListener() { |
| 155 |
public void keyPressed(KeyEvent e) { |
| 156 |
if (e.keyCode == SWT.ARROW_DOWN) |
| 157 |
fPluginViewer.getControl().setFocus(); |
| 158 |
} |
| 159 |
|
| 160 |
public void keyReleased(KeyEvent e) { |
| 161 |
} |
| 162 |
}); |
| 163 |
|
| 98 |
tablePart.createControl(container, 3); |
164 |
tablePart.createControl(container, 3); |
| 99 |
CheckboxTableViewer pluginViewer = tablePart.getTableViewer(); |
165 |
fPluginViewer = tablePart.getTableViewer(); |
| 100 |
pluginViewer.setContentProvider(new PluginContentProvider()); |
166 |
fPluginViewer.setContentProvider(new PluginContentProvider()); |
| 101 |
pluginViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); |
167 |
fPluginViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); |
| 102 |
pluginViewer.setComparator(ListUtil.PLUGIN_COMPARATOR); |
168 |
fPluginViewer.setComparator(ListUtil.PLUGIN_COMPARATOR); |
|
|
169 |
fPluginViewer.addFilter(fPluginFilter); |
| 103 |
gd = (GridData) tablePart.getControl().getLayoutData(); |
170 |
gd = (GridData) tablePart.getControl().getLayoutData(); |
| 104 |
if (launchConfigs.length > 0) { |
171 |
if (launchConfigs.length > 0) { |
| 105 |
gd.horizontalIndent = 30; |
172 |
gd.horizontalIndent = 30; |
|
Lines 107-113
Link Here
|
| 107 |
} |
174 |
} |
| 108 |
gd.heightHint = 250; |
175 |
gd.heightHint = 250; |
| 109 |
gd.widthHint = 300; |
176 |
gd.widthHint = 300; |
| 110 |
pluginViewer.setInput(PDECore.getDefault().getModelManager()); |
177 |
fPluginViewer.setInput(PDECore.getDefault().getModelManager()); |
| 111 |
tablePart.setSelection(new Object[0]); |
178 |
tablePart.setSelection(new Object[0]); |
| 112 |
tablePart.setEnabled(!initLaunch); |
179 |
tablePart.setEnabled(!initLaunch); |
| 113 |
setControl(container); |
180 |
setControl(container); |