Author: rob.stryker(a)jboss.com
Date: 2008-10-20 15:37:59 -0400 (Mon, 20 Oct 2008)
New Revision: 11013
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
Log:
JBIDE-2649 - warnings and errors now (again) in title area dialog
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java 2008-10-20
19:16:34 UTC (rev 11012)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/util/composites/ArchiveSourceDestinationComposite.java 2008-10-20
19:37:59 UTC (rev 11013)
@@ -60,7 +60,7 @@
*/
public class ArchiveSourceDestinationComposite extends Composite {
private Text text;
- private Label pathImage, translatedPath, translatedPathImage, relativeTo;
+ private Label pathImage, relativeTo;
private Button workspaceButton, filesystemButton, variablesButton,
wsRadioButton, fsRadioButton;
@@ -68,8 +68,8 @@
private boolean workspaceRelative = false;
private IArchiveNode destinationNode;
private String path;
- private boolean error;
- private String errorString;
+ private int statusType;
+ private String message;
private double version;
private ArrayList<ChangeListener> listeners = new
ArrayList<ChangeListener>();
@@ -87,8 +87,6 @@
protected void createWidgets() {
text = new Text(this, SWT.SINGLE | SWT.BORDER);
pathImage = new Label(this, SWT.NONE);
- translatedPath = new Label(this, SWT.NONE);
- translatedPathImage = new Label(this, SWT.NONE);
workspaceButton = new Button(this, SWT.PUSH);
filesystemButton = new Button(this, SWT.PUSH);
variablesButton = new Button(this, SWT.PUSH);
@@ -106,8 +104,6 @@
fsRadioButton.setLayoutData(createFormData(text,5,null,0,null,0,variablesButton,-5));
wsRadioButton.setLayoutData(createFormData(text,5,null,0,null,0,fsRadioButton,-5));
relativeTo.setLayoutData(createFormData(text,8,null,0,null,0,wsRadioButton,-5));
- translatedPathImage.setLayoutData(createFormData(filesystemButton,5,null,0,0,0,0,20));
- translatedPath.setLayoutData(createFormData(filesystemButton,5,null,0,translatedPathImage,5,100,-5));
}
protected void setWidgetData() {
@@ -118,12 +114,6 @@
fsRadioButton.setText(ArchivesUIMessages.Filesystem2);
relativeTo.setText(ArchivesUIMessages.RelativeTo);
pathImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
- FontData[] translatedPathData = translatedPath.getFont().getFontData();
- for( int i = 0; i < translatedPathData.length; i++ )
- translatedPathData[i].setHeight(7);
- Font newFont = new Font(Display.getDefault(), translatedPathData);
- translatedPath.setFont(newFont);
- translatedPathImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
}
protected void addListeners() {
@@ -225,8 +215,8 @@
protected void validateAndUpdateWidgets() {
// clear old status
- error = false;
- errorString = null;
+ statusType = IStatus.OK;
+ message = null;
wsRadioButton.setEnabled(destinationNode == null);
@@ -254,6 +244,8 @@
if( translated == null || !new Path(translated).toFile().exists()) {
translated= NLS.bind(ArchivesUIMessages.PathDoesNotExistInFilesystem,translated);
img =
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ statusType = IStatus.WARNING;
+ message = translated;
} else {
img = null;
}
@@ -262,14 +254,17 @@
translated = ce.getMessage();
if( ce.getStatus().getSeverity() == IStatus.ERROR) {
img =
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- error = true;
- errorString = ce.getMessage();
- } else if( ce.getStatus().getSeverity() == IStatus.WARNING)
+ statusType = IStatus.ERROR;
+ message = ce.getMessage();
+ } else if( ce.getStatus().getSeverity() == IStatus.WARNING) {
img =
PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ statusType = IStatus.WARNING;
+ message = ce.getMessage();
+ }
}
- translatedPathImage.setImage(img);
- translatedPath.setText(translated);
+// translatedPathImage.setImage(img);
+// translatedPath.setText(translated);
fireChange();
}
@@ -354,13 +349,17 @@
}
public boolean isValid() {
- return !error;
+ return statusType != IStatus.ERROR;
}
- public String getErrorMessage() {
- return errorString;
+ public String getMessage() {
+ return message;
}
+ public int getStatusType() {
+ return statusType;
+ }
+
public boolean isWorkspaceRelative() {
return workspaceRelative;
}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2008-10-20
19:16:34 UTC (rev 11012)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/ArchiveInfoWizardPage.java 2008-10-20
19:37:59 UTC (rev 11013)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -30,7 +31,6 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.model.ArchiveNodeFactory;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
@@ -176,12 +176,15 @@
}
private boolean validate () {
- String errorMessage = null;
- if (packageNameText.getText() == null || packageNameText.getText().length() == 0)
- errorMessage = ArchivesUIMessages.PackageInfoWizardPage_error_noPackageName;
- else if( !destinationComposite.isValid() )
- errorMessage = destinationComposite.getErrorMessage();
- else if( destinationComposite.getDestinationNode() != null ) {
+ String message = null;
+ int messageType = IStatus.OK;
+ if (packageNameText.getText() == null || packageNameText.getText().length() == 0) {
+ message = ArchivesUIMessages.PackageInfoWizardPage_error_noPackageName;
+ messageType = IStatus.ERROR;
+ } else if( destinationComposite.getMessage() != null ) {
+ message = destinationComposite.getMessage();
+ messageType = destinationComposite.getStatusType();
+ } else if( destinationComposite.getDestinationNode() != null ) {
IArchiveNode parentNode = destinationComposite.getDestinationNode();
// verify no child has the same name
IArchiveNode subPackages[] = parentNode.getChildren(IArchiveNode.TYPE_ARCHIVE);
@@ -189,9 +192,10 @@
IArchive subPackage = (IArchive) subPackages[i];
if (subPackage.getName().equals(packageNameText.getText())
&& (!subPackage.equals(this.archive))) {
- errorMessage = ArchivesUIMessages.bind(
+ message = ArchivesUIMessages.bind(
ArchivesUIMessages.PackageInfoWizardPage_error_packageAlreadyExists,
packageNameText.getText());
+ messageType = IStatus.ERROR;
}
}
} else if( destinationComposite.getPath() != null ) {
@@ -213,18 +217,19 @@
if (pkg.getName().equals(packageNameText.getText())
&& (PathUtils.getGlobalLocation(pkg)!= null &&
PathUtils.getGlobalLocation(pkg).equals(destinationLocation))
&& (!pkg.equals(this.archive))) {
- errorMessage = ArchivesUIMessages.bind(
+ message = ArchivesUIMessages.bind(
ArchivesUIMessages.PackageInfoWizardPage_error_packageAlreadyExists,
packageNameText.getText());
+ messageType = IStatus.ERROR;
}
}
}
} else {
- errorMessage = (ArchivesUIMessages.PackageInfoWizardPage_error_noDestination);
+ message = (ArchivesUIMessages.PackageInfoWizardPage_error_noDestination);
}
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- return errorMessage == null;
+ setPageComplete(message == null || messageType <= IStatus.WARNING);
+ setMessage(message, messageType);
+ return messageType <= IStatus.WARNING;
}
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java
===================================================================
---
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2008-10-20
19:16:34 UTC (rev 11012)
+++
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/wizards/pages/FilesetInfoWizardPage.java 2008-10-20
19:37:59 UTC (rev 11013)
@@ -11,12 +11,10 @@
package org.jboss.ide.eclipse.archives.ui.wizards.pages;
import java.util.ArrayList;
-import java.util.Arrays;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -38,12 +36,9 @@
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.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
-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;
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import
org.jboss.ide.eclipse.archives.ui.util.composites.ArchiveFilesetDestinationComposite;
@@ -254,12 +249,12 @@
}
private boolean validate () {
- String errorMessage = null;
- if( !srcDestComposite.isValid() )
- errorMessage = srcDestComposite.getErrorMessage();
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- return errorMessage == null;
+ String message = srcDestComposite.getMessage();
+ int messageType = srcDestComposite.getStatusType();
+
+ setMessage(message, messageType);
+ setPageComplete(messageType <= IStatus.WARNING);
+ return messageType <= IStatus.WARNING;
}