[jboss-cvs] jbosside/core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util ...
Marshall Culpepper
mculpepper at jboss.com
Fri Feb 16 13:39:19 EST 2007
User: mculpepper
Date: 07/02/16 13:39:19
Modified: core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util
PackageDestinationComposite.java
PackageNodeDestinationComposite.java
Log:
package node destination composite now gives enough room to see all or most of the selected path (even for filesystem targets). also, the widget has been changed to a Text so it is selectable and copy/paste-able
Revision Changes Path
1.4 +2 -2 jbosside/core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util/PackageDestinationComposite.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PackageDestinationComposite.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util/PackageDestinationComposite.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- PackageDestinationComposite.java 14 Feb 2007 17:54:41 -0000 1.3
+++ PackageDestinationComposite.java 16 Feb 2007 18:39:19 -0000 1.4
@@ -69,8 +69,8 @@
{
inWorkspace = false;
IPath path = (IPath) nodeDestination;
- destinationImage.setImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_EXTERNAL_FILE));
- destinationText.setText(path.toString());
+ setDestinationText(path.toString());
+ setDestinationImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_EXTERNAL_FILE));
}
else if (nodeDestination instanceof IContainer || nodeDestination instanceof IPackageNode)
{
1.4 +59 -14 jbosside/core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util/PackageNodeDestinationComposite.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PackageNodeDestinationComposite.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/core/plugins/org.jboss.ide.eclipse.packages.ui/src/main/org/jboss/ide/eclipse/packages/ui/util/PackageNodeDestinationComposite.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- PackageNodeDestinationComposite.java 14 Feb 2007 18:52:16 -0000 1.3
+++ PackageNodeDestinationComposite.java 16 Feb 2007 18:39:19 -0000 1.4
@@ -7,13 +7,19 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.GlyphMetrics;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
@@ -27,7 +33,7 @@
protected Composite parent;
protected Label destinationImage;
- protected Label destinationText;
+ protected Text destinationText;
protected Button destinationBrowseButton;
protected Object nodeDestination;
protected boolean editable;
@@ -45,20 +51,43 @@
protected void createComposite()
{
- setLayout(new GridLayout(2, false));
- setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+
+ setLayout(layout);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ setLayoutData(data);
destinationImage = new Label(this, SWT.NONE);
- destinationText = new Label(this, SWT.NONE);
+ destinationText = new Text(this, SWT.BORDER);
+ destinationText.setEditable(false);
+
updateDestinationViewer();
destinationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- createBrowseButton(parent);
+ new Label(parent, SWT.NONE);
+ new Label(parent, SWT.NONE);
+
+ Composite buttons = new Composite(parent, SWT.NONE);
+ RowLayout buttonLayout = new RowLayout(SWT.HORIZONTAL);
+ buttonLayout.marginBottom = buttonLayout.marginLeft = buttonLayout.marginRight = buttonLayout.marginTop = 0;
+ buttonLayout.spacing = buttonLayout.marginHeight = buttonLayout.marginWidth = 0;
+
+ buttons.setLayout(buttonLayout);
+ GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
+ buttonData.horizontalSpan = 2;
+ buttonData.horizontalAlignment = GridData.END;
+ buttonData.verticalAlignment = GridData.BEGINNING;
+ buttons.setLayoutData(buttonData);
+
+ createBrowseButton(buttons);
}
protected void createBrowseButton (Composite parent)
{
+
destinationBrowseButton = new Button(parent, SWT.PUSH);
destinationBrowseButton.setText(PackagesUIMessages.PackageNodeDestinationComposite_destinationBrowseButton_label);
@@ -93,38 +122,54 @@
updateDestinationViewer();
}
+ protected void setDestinationImage (Image image)
+ {
+ destinationImage.setImage(image);
+ }
+
+ protected void setDestinationText (String text)
+ {
+ destinationText.setText(text);
+ }
+
protected void updateDestinationViewer ()
{
if (nodeDestination == null) return;
+ destinationText.setText("");
if (nodeDestination instanceof IPackage)
{
IPackage pkg = (IPackage) nodeDestination;
+ if (pkg.isTopLevel())
+ {
+ setDestinationText(pkg.getName());
+ } else {
+ setDestinationText(pkg.getPackageRelativePath().toString());
+ }
if (pkg.isExploded()) {
- destinationImage.setImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_PACKAGE_EXPLODED));
+ setDestinationImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_PACKAGE_EXPLODED));
} else {
- destinationImage.setImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_PACKAGE));
+ setDestinationImage(PackagesUIPlugin.getImage(PackagesUIPlugin.IMG_PACKAGE));
}
- destinationText.setText(pkg.getName());
}
else if (nodeDestination instanceof IPackageFolder)
{
IPackageFolder folder = (IPackageFolder) nodeDestination;
- destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
- destinationText.setText(folder.getPackageRelativePath().toString());
+ setDestinationText(folder.getPackageRelativePath().toString());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
}
else if (nodeDestination instanceof IProject)
{
IProject project = (IProject) nodeDestination;
- destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
- destinationText.setText(project.getName());
+ setDestinationText(project.getName());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
}
else if (nodeDestination instanceof IFolder)
{
IFolder folder = (IFolder) nodeDestination;
- destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
- destinationText.setText(folder.getProjectRelativePath().toString());
+ setDestinationText("/" + folder.getProject().getName() + "/" + folder.getProjectRelativePath().toString());
+ setDestinationImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
}
}
More information about the jboss-cvs-commits
mailing list