Author: dgolovin
Date: 2011-01-31 16:24:50 -0500 (Mon, 31 Jan 2011)
New Revision: 28790
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
Log:
https://issues.jboss.org/browse/JBIDE-7788 Fileset Wizard has wrong layout
this fix contains:
1. fixed layout
2. some minor changes in texts: Flatten? -> Flatten:, Related to -> Related:
3. Layout for labels with Icons was adjusted to <Label text> <Icon> for all
fields, if there is no icon for field empty label used to preserve layout.
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2011-01-31
21:24:50 UTC (rev 28790)
@@ -10,7 +10,7 @@
Filesystem=Filesystem...
Workspace=Workspace...
Variables=Variables...
-RelativeTo=Relative to
+RelativeTo=Relative to:
Workspace2=Workspace relative
Filesystem2=Filesystem relative
PathDoesNotExistInFilesystem={0} does not exist in the filesystem
@@ -22,7 +22,7 @@
DefaultJarConfiguration=Default JAR Configuration
Preview=Preview
UseDefaultJARConfiguration=Use default JAR configuration
-Flatten=Flatten?
+Flatten=Flatten:
Yes=Yes
No=No
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveFilesetDestinationComposite.java 2011-01-31
21:24:50 UTC (rev 28790)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.ui.util.composites;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
@@ -21,8 +22,7 @@
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
@@ -46,15 +46,16 @@
* @author "Rob Stryker" <rob.stryker(a)redhat.com>
*
*/
-public class ArchiveFilesetDestinationComposite extends Composite {
+public class ArchiveFilesetDestinationComposite {
protected Composite parent;
protected Label destinationImage;
protected Text destinationText;
protected Object nodeDestination;
+ private Label destinationKey;
+ private Composite browseComposite;
public ArchiveFilesetDestinationComposite(Composite parent, int style, Object
destination) {
- super(parent, style);
this.parent = parent;
this.nodeDestination = destination;
@@ -62,56 +63,32 @@
}
protected void createComposite() {
- setLayout(new FormLayout());
-
+ destinationKey = new Label(this.parent,SWT.NONE);
+ destinationKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_destination_label);
+ destinationKey.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
// create widgets
- destinationImage = new Label(this, SWT.NONE);
- destinationText = new Text(this, SWT.BORDER);
- Composite browseComposite = new Composite(this, SWT.NONE);
-
- // set up their layout positioning
- destinationImage.setLayoutData(createFormData(0,5,null, 0, 0, 0, null, 0));
- destinationText.setLayoutData(createFormData(0, 5, null, 0, destinationImage, 5,
destinationImage, 205));
-
-
- // set text, add listeners, etc
+ destinationImage = new Label(this.parent, SWT.NONE);
+
+ browseComposite = new Composite(this.parent, SWT.NONE);
+ GridLayout gl = new GridLayout(2,false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ browseComposite.setLayout(gl);
+ browseComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ destinationText = new Text(this.browseComposite, SWT.BORDER);
destinationText.setEditable(false);
-
- browseComposite.setLayout(new FillLayout());
- browseComposite.setLayoutData(createFormData(0,0,null,0,destinationText,5,100,-5));
- fillBrowseComposite(browseComposite);
-
- // call other functions required for startup
+ destinationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Button filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
+ filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
+ filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
+ public void widgetSelected(SelectionEvent e) {
+ openDestinationDialog();
+ }
+ });
updateDestinationViewer();
}
- private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int
bottomOffset,
- Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
- FormData data = new FormData();
-
- if( topStart != null ) {
- data.top = topStart instanceof Control ? new FormAttachment((Control)topStart,
topOffset) :
- new FormAttachment(((Integer)topStart).intValue(), topOffset);
- }
-
- if( bottomStart != null ) {
- data.bottom = bottomStart instanceof Control ? new
FormAttachment((Control)bottomStart, bottomOffset) :
- new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
- }
-
- if( leftStart != null ) {
- data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart,
leftOffset) :
- new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
- }
-
- if( rightStart != null ) {
- data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart,
rightOffset) :
- new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
- }
-
- return data;
- }
-
public void setPackageNodeDestination (Object destination) {
nodeDestination = destination;
updateDestinationViewer();
@@ -148,21 +125,9 @@
return nodeDestination;
}
- protected void fillBrowseComposite(Composite parent) {
- Composite browseComposite = new Composite(parent, SWT.NONE);
- browseComposite.setLayout(new GridLayout(2, false));
- Button filesystemBrowseButton = new Button(browseComposite, SWT.PUSH);
- filesystemBrowseButton.setText(ArchivesUIMessages.PackageDestinationComposite_workspaceBrowseButton_label);
- filesystemBrowseButton.addSelectionListener(new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- openDestinationDialog();
- }
- });
- }
-
protected void openDestinationDialog() {
- ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(),
false, true);
+ ArchiveNodeDestinationDialog dialog = new
ArchiveNodeDestinationDialog(parent.getShell(), false, true);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
if( selection != null && selection.length == 1 ) {
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java 2011-01-31
21:24:50 UTC (rev 28790)
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.variables.IStringVariable;
import org.eclipse.debug.ui.StringVariableSelectionDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.window.Window;
@@ -29,15 +28,11 @@
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
@@ -58,7 +53,7 @@
* @author "Rob Stryker" <rob.stryker(a)redhat.com>
*
*/
-public class ArchiveSourceDestinationComposite extends Composite {
+public class ArchiveSourceDestinationComposite {
private Text text;
private Label pathImage, relativeTo;
private Button workspaceButton, filesystemButton, variablesButton,
@@ -72,12 +67,16 @@
private String message;
private double version;
private ArrayList<ChangeListener> listeners = new
ArrayList<ChangeListener>();
+ private String label;
+ private Label destination;
+ private Composite parent;
+ private Composite relativeToEditor;
- public ArchiveSourceDestinationComposite(Composite parent, String project, double
version) {
- super(parent, SWT.NONE);
+ public ArchiveSourceDestinationComposite(String label, Composite parent, String project,
double version) {
+ this.parent = parent;
+ this.label = label;
this.projectName = project;
this.version = version;
- setLayout(new FormLayout());
createWidgets();
layoutWidgets();
setWidgetData();
@@ -85,25 +84,31 @@
}
protected void createWidgets() {
- text = new Text(this, SWT.SINGLE | SWT.BORDER);
- pathImage = new Label(this, SWT.NONE);
- workspaceButton = new Button(this, SWT.PUSH);
- filesystemButton = new Button(this, SWT.PUSH);
- variablesButton = new Button(this, SWT.PUSH);
- wsRadioButton = new Button(this, SWT.RADIO);
- fsRadioButton = new Button(this, SWT.RADIO);
- relativeTo = new Label(this, SWT.NONE);
+ destination = new Label(this.parent, SWT.NONE);
+ destination.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
+ pathImage = new Label(this.parent, SWT.NONE);
+ text = new Text(this.parent, SWT.SINGLE | SWT.BORDER);
+
+ relativeTo = new Label(this.parent, SWT.NONE);
+ relativeTo.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
+ new Label(this.parent,SWT.NONE);
+ relativeToEditor = new Composite(parent,SWT.NONE);
+ GridLayout gl = new GridLayout(6,false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ relativeToEditor.setLayout(gl);
+ fsRadioButton = new Button(relativeToEditor, SWT.RADIO);
+ wsRadioButton = new Button(relativeToEditor, SWT.RADIO);
+ variablesButton = new Button(relativeToEditor, SWT.PUSH);
+ filesystemButton = new Button(relativeToEditor, SWT.PUSH);
+ workspaceButton = new Button(relativeToEditor, SWT.PUSH);
+ new Label(relativeToEditor,SWT.NONE);
+
}
protected void layoutWidgets() {
- pathImage.setLayoutData(createFormData(0,0,null,0,0,0,null,0));
- text.setLayoutData(createFormData(0,0,null,0,pathImage,5,100,0));
- relativeTo.setLayoutData(createFormData(text,10,null,0,null,0,null,-5));
- fsRadioButton.setLayoutData(createFormData(text,8,null,0,relativeTo,5,null,0));
- wsRadioButton.setLayoutData(createFormData(text,8,null,0,fsRadioButton,5,null,0));
- variablesButton.setLayoutData(createFormData(text,5,null,0,wsRadioButton,5,null,0));
- workspaceButton.setLayoutData(createFormData(text,5,null,0,variablesButton,5,null,0));
- filesystemButton.setLayoutData(createFormData(text,5,null,0,workspaceButton,5,null,0));
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ relativeToEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
protected void setWidgetData() {
@@ -114,6 +119,7 @@
fsRadioButton.setText(ArchivesUIMessages.Filesystem2);
relativeTo.setText(ArchivesUIMessages.RelativeTo);
pathImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
+ destination.setText(label);
}
protected void addListeners() {
@@ -167,7 +173,7 @@
}
protected void openDestinationDialog() {
- ArchiveNodeDestinationDialog dialog = new ArchiveNodeDestinationDialog(getShell(),
true, true);
+ ArchiveNodeDestinationDialog dialog = new
ArchiveNodeDestinationDialog(parent.getShell(), true, true);
if( dialog.open() == Dialog.OK ) {
Object result = dialog.getResult()[0];
if( result instanceof IArchiveNode ) {
@@ -189,7 +195,7 @@
}
protected void browseFilesystem () {
- DirectoryDialog dialog = new DirectoryDialog(getShell());
+ DirectoryDialog dialog = new DirectoryDialog(parent.getShell());
String currentPath = null;
try {
currentPath = getTranslatedGlobalPath();
@@ -299,40 +305,6 @@
}
}
- private FormData createFormData(Object topStart, int topOffset,
- Object bottomStart, int bottomOffset, Object leftStart,
- int leftOffset, Object rightStart, int rightOffset) {
- FormData data = new FormData();
-
- if (topStart != null) {
- data.top = topStart instanceof Control ? new FormAttachment(
- (Control) topStart, topOffset) : new FormAttachment(
- ((Integer) topStart).intValue(), topOffset);
- }
-
- if (bottomStart != null) {
- data.bottom = bottomStart instanceof Control ? new FormAttachment(
- (Control) bottomStart, bottomOffset) : new FormAttachment(
- ((Integer) bottomStart).intValue(), bottomOffset);
- }
-
- if (leftStart != null) {
- data.left = leftStart instanceof Control ? new FormAttachment(
- (Control) leftStart, leftOffset) : new FormAttachment(
- ((Integer) leftStart).intValue(), leftOffset);
- }
-
- if (rightStart != null) {
- data.right = rightStart instanceof Control ? new FormAttachment(
- (Control) rightStart, rightOffset) : new FormAttachment(
- ((Integer) rightStart).intValue(), rightOffset);
- }
-
- return data;
- }
-
-
-
// APIs
public void init(IArchiveNode dest) {
destinationNode = dest;
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/FilesetPreviewComposite.java 2011-01-31
21:24:50 UTC (rev 28790)
@@ -37,13 +37,14 @@
previewTable = new TableViewer(this, SWT.BORDER);
previewTable.setContentProvider(new ArrayContentProvider());
previewTable.setLabelProvider(new ResourceLabelProvider());
-
+
setLayout(new FormLayout());
FormData data = new FormData();
data.left = new FormAttachment(0,5);
data.right = new FormAttachment(100,-5);
data.top = new FormAttachment(0,5);
data.bottom = new FormAttachment(100,-5);
+ data.height = 200;
previewTable.getTable().setLayoutData(data);
}
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2011-01-31
21:24:50 UTC (rev 28790)
@@ -37,7 +37,6 @@
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeFactory;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
@@ -81,26 +80,19 @@
infoGroup.setText(ArchivesUIMessages.PackageInfoWizardPage_infoGroup_label);
expand(infoGroup);
- new Label(infoGroup,
SWT.NONE).setText(ArchivesUIMessages.PackageInfoWizardPage_packageName_label);
- Composite pkgNameComposite = new Composite(infoGroup, SWT.NONE);
- GridLayout pkgNameLayout = new GridLayout(2, false);
- pkgNameLayout.marginHeight = 0;
- pkgNameLayout.marginWidth = 0;
- pkgNameComposite.setLayout(pkgNameLayout);
- pkgNameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Label archName = new Label(infoGroup, SWT.NONE);
+ archName.setText(ArchivesUIMessages.PackageInfoWizardPage_packageName_label);
+ archName.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
- new Label(pkgNameComposite,
SWT.NONE).setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE));
+ Label archImage = new Label(infoGroup, SWT.NONE);
+ archImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_PACKAGE));
- packageNameText = new Text(pkgNameComposite, SWT.BORDER);
+ packageNameText = new Text(infoGroup, SWT.BORDER);
packageName = wizard.getProject().getName() + "." +
wizard.getArchiveExtension(); //$NON-NLS-1$
packageNameText.setText(packageName);
packageNameText.setSelection(0, wizard.getProject().getName().length());
expand(packageNameText);
- GridData pkgNameData = new GridData(GridData.FILL_HORIZONTAL);
- pkgNameData.horizontalSpan = 2;
- pkgNameComposite.setLayoutData(pkgNameData);
-
packageNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (validate()) {
@@ -109,24 +101,15 @@
}
});
- Label l = new Label(infoGroup, SWT.NONE);
- l.setText(ArchivesUIMessages.PackageInfoWizardPage_destination_label);
- GridData lData = new GridData(GridData.BEGINNING, GridData.BEGINNING,false,false);
- l.setLayoutData(lData);
-
GridData destinationTextData = new GridData(GridData.FILL_BOTH);
- destinationTextData.horizontalSpan = 2;
- GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
- buttonData.horizontalSpan = 3;
- buttonData.horizontalAlignment = SWT.END;
+ destinationTextData.horizontalSpan = 3;
- destinationComposite = new ArchiveSourceDestinationComposite(infoGroup,
wizard.getProject().getName(), getDescriptorVersion());
+ destinationComposite = new
ArchiveSourceDestinationComposite(ArchivesUIMessages.PackageInfoWizardPage_destination_label,
infoGroup, wizard.getProject().getName(), getDescriptorVersion());
destinationComposite.addChangeListener(new ChangeListener () {
public void compositeChanged() {
validate();
}
});
- destinationComposite.setLayoutData(destinationTextData);
Group packageTypeGroup = new Group(main, SWT.NONE);
packageTypeGroup.setLayout(new GridLayout(1, false));
Modified:
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
===================================================================
---
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2011-01-31
20:27:54 UTC (rev 28789)
+++
branches/jbosstools-3.2.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2011-01-31
21:24:50 UTC (rev 28790)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.ui.wizards.pages;
+import java.awt.FlowLayout;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
@@ -24,10 +25,12 @@
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -38,10 +41,10 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import
org.jboss.ide.eclipse.archives.core.model.other.internal.WorkspacePreferenceManager;
import org.jboss.ide.eclipse.archives.ui.ArchivesSharedImages;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
@@ -76,6 +79,7 @@
private Text includesText;
private Text excludesText;
private ArchiveFilesetDestinationComposite destinationComposite;
+ private Composite flattenedEditor;
public FilesetInfoWizardPage (Shell parent, IArchiveStandardFileSet fileset,
IArchiveNode parentNode) {
super(ArchivesUIMessages.FilesetInfoWizardPage_new_title,
ArchivesUIMessages.FilesetInfoWizardPage_new_title, null);
@@ -97,18 +101,9 @@
mainComposite = new Composite(parent, SWT.BORDER);
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- mainComposite.setLayout(new FormLayout());
- Composite restrainer = new Composite(mainComposite, SWT.NONE);
- restrainer.setLayout(new FormLayout());
- FormData restrainerData = new FormData();
- restrainerData.left = new FormAttachment(0,5);
- restrainerData.top = new FormAttachment(0,5);
- restrainerData.bottom = new FormAttachment(100,-5);
- restrainerData.right = new FormAttachment(100,-5);
- restrainer.setLayoutData(restrainerData);
-
- Group info = createInfoGroup(restrainer);
- createPreviewGroup(restrainer, info);
+ mainComposite.setLayout(new GridLayout(1, false));
+ Group info = createInfoGroup(mainComposite);
+ createPreviewGroup(mainComposite, info);
//mainComposite.layout();
Display.getDefault().asyncExec(new Runnable(){
public void run() {
@@ -121,105 +116,52 @@
setControl(mainComposite);
}
- private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int
bottomOffset,
- Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
- FormData data = new FormData();
-
- if( topStart != null ) {
- data.top = topStart instanceof Control ? new FormAttachment((Control)topStart,
topOffset) :
- new FormAttachment(((Integer)topStart).intValue(), topOffset);
- }
-
- if( bottomStart != null ) {
- data.bottom = bottomStart instanceof Control ? new
FormAttachment((Control)bottomStart, bottomOffset) :
- new FormAttachment(((Integer)bottomStart).intValue(), bottomOffset);
- }
-
- if( leftStart != null ) {
- data.left = leftStart instanceof Control ? new FormAttachment((Control)leftStart,
leftOffset) :
- new FormAttachment(((Integer)leftStart).intValue(), leftOffset);
- }
-
- if( rightStart != null ) {
- data.right = rightStart instanceof Control ? new FormAttachment((Control)rightStart,
rightOffset) :
- new FormAttachment(((Integer)rightStart).intValue(), rightOffset);
- }
-
- return data;
- }
-
-
private Group createPreviewGroup(Composite mainComposite, Group info) {
Group previewGroup = new Group(mainComposite, SWT.NONE);
- previewGroup.setLayoutData(createFormData(info,5,100,-5,0,5,100,-5));
- previewGroup.setLayout(new FormLayout());
- Label invisibleLabel = new Label(previewGroup, SWT.NONE);
- invisibleLabel.setLayoutData(createFormData(0,0,0,200,0,0,0,1));
+ previewGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
+ previewGroup.setLayout(new GridLayout());
previewComposite = new FilesetPreviewComposite(previewGroup, SWT.NONE);
- previewComposite.setLayoutData(createFormData(0,0,100,0,0,0,100,0));
+ previewComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
previewGroup.setText(ArchivesUIMessages.FilesetInfoWizardPage_previewGroup_label);
+
return previewGroup;
}
private Group createInfoGroup(Composite mainComposite) {
Group infoGroup = new Group(mainComposite, SWT.NONE);
infoGroup.setText(ArchivesUIMessages.FilesetInfoWizardPage_infoGroup_title);
-
- // positioning in parent
- infoGroup.setLayoutData(createFormData(0,5,null,0,0,5,100,-5));
-
- // my layout
- infoGroup.setLayout(new FormLayout());
-
- // destination row
- Label destinationKey = new Label(infoGroup, SWT.NONE);
+ infoGroup.setLayout(new GridLayout(3,false));
+ infoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
destinationComposite = new ArchiveFilesetDestinationComposite(infoGroup, SWT.NONE,
parentNode);
- destinationKey.setLayoutData(createFormData(0,10,null,0,null,5, 0, 100));
- destinationComposite.setLayoutData(createFormData(0,5,null,0,destinationKey,5, 100,
-5));
-
// root dir
- Label rootDirectoryLabel = new Label(infoGroup, SWT.NONE);
- srcDestComposite = new ArchiveSourceDestinationComposite(infoGroup, projectName,
getDescriptorVersion());
- Composite rootDirValue = srcDestComposite;
- rootDirectoryLabel.setLayoutData(createFormData(destinationComposite,10,null,0,null,5,0,100));
- rootDirValue.setLayoutData(createFormData(destinationComposite,5,null,0,rootDirectoryLabel,5,100,-5));
+ srcDestComposite = new
ArchiveSourceDestinationComposite(ArchivesUIMessages.FilesetInfoWizardPage_rootDirectory_label,
infoGroup, projectName, getDescriptorVersion());
flattenedLabel = new Label(infoGroup, SWT.NONE);
- flattenedYes = new Button(infoGroup, SWT.RADIO);
- flattenedNo = new Button(infoGroup, SWT.RADIO);
- flattenedLabel.setLayoutData(createFormData(rootDirValue,5,null,0,null,0,rootDirValue,-5));
- flattenedYes.setLayoutData(createFormData(rootDirValue, 5,
null,0,flattenedLabel,5,null,0));
- flattenedNo.setLayoutData(createFormData(rootDirValue, 5,
null,0,flattenedYes,5,null,0));
+ flattenedLabel.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
+ new Label(infoGroup, SWT.NONE); // no icon for this field
+
+ flattenedEditor = new Composite(infoGroup,SWT.NONE);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 0;
+ fillLayout.marginWidth = 0;
+ flattenedEditor.setLayout(fillLayout);
+ flattenedYes = new Button(flattenedEditor, SWT.RADIO);
+ flattenedNo = new Button(flattenedEditor, SWT.RADIO);
- // includes composite and it's internals
- Composite includesKey = new Composite(infoGroup, SWT.NONE);
- includesKey.setLayout(new FormLayout());
- Label includesImage = new Label(includesKey, SWT.NONE);
- Label includesTextLabel = new Label(includesKey, SWT.NONE);
+ Label includesTextLabel = new Label(infoGroup, SWT.NONE);
+ includesTextLabel.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
+ Label includesImage = new Label(infoGroup, SWT.NONE);
includesText = new Text(infoGroup, SWT.BORDER);
- includesImage.setLayoutData(createFormData(0,0,null,0,0,0,null,0));
- includesTextLabel.setLayoutData(createFormData(0,0,null,0,includesImage,5,null,0));
+ includesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- includesKey.setLayoutData(createFormData(flattenedLabel,5,null,0,null,5,0,100));
- includesText.setLayoutData(createFormData(flattenedLabel,5,null,0,includesKey,10,100,-5));
-
-
- // excludes composite and it's internals
- Composite excludesKey = new Composite(infoGroup, SWT.NONE);
- excludesKey.setLayout(new FormLayout());
- Label excludesImage = new Label(excludesKey, SWT.NONE);
- Label excludesTextLabel = new Label(excludesKey, SWT.NONE);
+ Label excludesTextLabel = new Label(infoGroup, SWT.NONE);
+ excludesTextLabel.setLayoutData(new GridData(SWT.END,SWT.CENTER,false,false));
+ Label excludesImage = new Label(infoGroup, SWT.NONE);
excludesText = new Text(infoGroup, SWT.BORDER);
- excludesImage.setLayoutData(createFormData(0,0,null,0,0,0,null,0));
- excludesTextLabel.setLayoutData(createFormData(0,0,null,0,excludesImage,5,null,0));
- excludesKey.setLayoutData(createFormData(includesText,5,null,0,null,5,0,100));
- excludesText.setLayoutData(createFormData(includesText,5,100,-5,excludesKey,10,100,-5));
-
+ excludesText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// customize widgets
- destinationKey.setText(ArchivesUIMessages.FilesetInfoWizardPage_destination_label);
- rootDirectoryLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_rootDirectory_label);
includesImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_INCLUDES));
includesTextLabel.setText(ArchivesUIMessages.FilesetInfoWizardPage_includes_label);
excludesImage.setImage(ArchivesSharedImages.getImage(ArchivesSharedImages.IMG_EXCLUDES));