[134335] Misc enhancements to SelectComponentDialog, AddAppinfoDialog
diff --git a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialog.java b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialog.java
index f355e14..7a41aba 100644
--- a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialog.java
+++ b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialog.java
@@ -18,6 +18,7 @@
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -117,7 +118,7 @@
GridData gData = (GridData) mainComposite.getLayoutData();
gData.heightHint = 500;
gData.widthHint = 400;
-
+
// Subclasses may use this Composite to add desired widgets
//topComposite = new Composite(mainComposite, SWT.NONE);
//topComposite.setLayoutData(new GridData());
@@ -162,26 +163,19 @@
}
public void widgetSelected(SelectionEvent e)
- {
+ {
+ handler.openNewComponentDialog();
}
});
}
- //Composite for table viewer
- Composite tableComp = new Composite(mainComposite, SWT.NONE);
- GridLayout tableCompLayout = new GridLayout();
- tableCompLayout.marginWidth = 0;
- tableCompLayout.marginTop = 0;
- tableComp.setLayoutData(new GridData(GridData.FILL_BOTH));
- tableComp.setLayout(tableCompLayout);
-
// Create Component TableViewer
- createComponentTableViewer(tableComp);
+ createComponentTableViewer(mainComposite);
componentTableViewer.getTable().addSelectionListener(new SelectionListener(){
// Changing the text for the component selected and display its source
// file in the box under the table viewer
- IComponentDescriptionProvider lp = configuration.getDescriptionProvider();
+ IComponentDescriptionProvider descriptionProvider = configuration.getDescriptionProvider();
public void widgetSelected(SelectionEvent e) {
run();
}
@@ -202,11 +196,10 @@
prevItemText = items[0].getText();
// add clarification for the first selected item
- items[0].setText( lp.getName(component) + " - " +
- lp.getQualifier(component));
+ items[0].setText( descriptionProvider.getName(component) + " - " +
+ descriptionProvider.getQualifier(component));
- IFile file = lp.getFile(component);
- updateLocationView(file);
+ updateLocationView(component, descriptionProvider);
}
});
@@ -221,7 +214,7 @@
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
- data.heightHint = 25;
+ data.heightHint = 22;
fileLocationView.setLayoutData(data);
locationLabel = new CLabel(fileLocationView, SWT.FLAT);
@@ -252,29 +245,6 @@
return mainComposite;
}
- protected TableViewer createFilterMenuAndTableViewer(Composite comp) {
- Composite labelAndFilter = new Composite(comp, SWT.NONE);
- labelAndFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout= new GridLayout();
- layout.numColumns= 2;
- layout.marginWidth= 0; layout.marginHeight= 0;
- labelAndFilter.setLayout(layout);
-
- Label tableLabel = new Label(labelAndFilter, SWT.NONE);
- tableLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- tableLabel.setText(configuration.getListLabelText());
-
- filterToolBar = new ToolBar(labelAndFilter,SWT.FLAT);
- configuration.createToolBarItems(filterToolBar);
-
- TableViewer TableViewer = new TableViewer(new Table(comp, SWT.SINGLE | SWT.BORDER));
- Control TableWidget = TableViewer.getTable();
- GridData gd = new GridData(GridData.FILL_BOTH);
- TableWidget.setLayoutData(gd);
-
- return TableViewer;
- }
-
/*
* Creates the Component TableViewer.
*/
@@ -291,8 +261,33 @@
});
}
- private void updateLocationView(IFile file) {
- //file Path relative to current workspace
+ protected TableViewer createFilterMenuAndTableViewer(Composite comp) {
+ Composite labelAndFilter = new Composite(comp, SWT.NONE);
+ labelAndFilter.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout= new GridLayout();
+ layout.numColumns= 2;
+ layout.marginWidth= 0; layout.marginHeight= 0;
+ labelAndFilter.setLayout(layout);
+
+ Label tableLabel = new Label(labelAndFilter, SWT.NONE);
+ tableLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ tableLabel.setText(configuration.getListLabelText());
+
+ filterToolBar = new ToolBar(labelAndFilter,SWT.FLAT);
+ configuration.createToolBarItems(filterToolBar);
+
+ TableViewer tableViewer = new TableViewer(new Table(labelAndFilter, SWT.SINGLE | SWT.BORDER));
+ Control TableWidget = tableViewer.getTable();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ TableWidget.setLayoutData(gd);
+
+ return tableViewer;
+ }
+
+ private void updateLocationView(Object component, IComponentDescriptionProvider lp) {
+ IFile file = lp.getFile(component);
+
if ( file == null ){
locationLabel.setText("");
locationLabel.setImage(null);
@@ -303,9 +298,7 @@
//locationView.redraw();
locationLabel.setText(filePath);
- // TODO.. get an image from the plugin
- //locationLabel.setImage(plugin.getImage("icons/XSDFile.gif"));
- //locationView.redraw();
+ locationLabel.setImage(lp.getFileIcon(component));
}
diff --git a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialogConfiguration.java b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialogConfiguration.java
index 6e6ef6a..23d9ebc 100644
--- a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialogConfiguration.java
+++ b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/ComponentSearchListDialogConfiguration.java
@@ -16,7 +16,7 @@
public class ComponentSearchListDialogConfiguration
{
private String filterLabelText = "Name:";
- private String listLabelText = "Components";
+ private String listLabelText = "Components:";
private IComponentSearchListProvider searchListProvider;
private IComponentDescriptionProvider descriptionProvider;
private INewComponentHandler newComponentHandler;
diff --git a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/IComponentDescriptionProvider.java b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/IComponentDescriptionProvider.java
index c4fbc0b..6389ff6 100644
--- a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/IComponentDescriptionProvider.java
+++ b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/IComponentDescriptionProvider.java
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.swt.graphics.Image;
public interface IComponentDescriptionProvider
{
@@ -22,6 +23,8 @@
String getName(Object component);
IFile getFile(Object component);
+
+ Image getFileIcon(Object component);
ILabelProvider getLabelProvider();
}
diff --git a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/Test.java b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/Test.java
index 732b3e4..d9883c2 100644
--- a/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/Test.java
+++ b/plugins/org.eclipse.wst.common.ui/src-search/org/eclipse/wst/common/ui/internal/search/dialogs/Test.java
@@ -15,6 +15,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.ActionDelegate;
@@ -85,6 +86,10 @@
}
return false;
}
+
+ public Image getFileIcon(Object component) {
+ return null;
+ }
}
IComponentSearchListProvider searchListProvider = new IComponentSearchListProvider()