summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Hussein2012-10-15 20:18:55 (EDT)
committer Mike Rennie2012-10-15 20:18:55 (EDT)
commit231ef131428719fb986eaa67511186dd9ec341fb (patch)
tree03487c5f5692283e236d4cff92c44a3e48a15164
parentb55a4bb203803a86d0792de5f9f17103c6cc09a0 (diff)
downloadeclipse.platform.debug-231ef131428719fb986eaa67511186dd9ec341fb.zip
eclipse.platform.debug-231ef131428719fb986eaa67511186dd9ec341fb.tar.gz
eclipse.platform.debug-231ef131428719fb986eaa67511186dd9ec341fb.tar.bz2
Bug 386673 - Show warning messages in launch configuration dialogv20121016-001855I20121016-0800
-rw-r--r--org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java26
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java28
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab2.java26
6 files changed, 96 insertions, 7 deletions
diff --git a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
index 1aef3d1..862a555 100644
--- a/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.examples.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.debug.examples.ui;singleton:=true
-Bundle-Version: 1.4.0.qualifier
+Bundle-Version: 1.4.100.qualifier
Bundle-Activator: org.eclipse.debug.examples.ui.pda.DebugUIPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
index 27b3a2f..ea854da 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/launcher/PDAMainTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Bjorn Freeman-Benson - initial API and implementation
+ * Mohamed Hussein (Mentor Graphics) - Added s/getWarningMessage (Bug 386673)
*******************************************************************************/
package org.eclipse.debug.examples.ui.pda.launcher;
@@ -168,6 +169,7 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
*/
public boolean isValid(ILaunchConfiguration launchConfig) {
setErrorMessage(null);
+ setWarningMessage(null);
setMessage(null);
String text = fProgramText.getText();
//#ifdef ex1
@@ -176,9 +178,14 @@ public class PDAMainTab extends AbstractLaunchConfigurationTab {
//#else
if (text.length() > 0) {
IPath path = new Path(text);
- if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) == null) {
+ IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (member == null) {
setErrorMessage("Specified program does not exist");
return false;
+ } else {
+ if (member.getType() != IResource.FILE) {
+ setWarningMessage("Specified program is not a file.");
+ }
}
} else {
setMessage("Specify a program");
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index 261b3f6..7f4b2bb 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Mohamed Hussein (Mentor Graphics) - Added getWarningMessage (Bug 386673)
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -38,6 +39,7 @@ import org.eclipse.debug.internal.ui.SWTFactory;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.debug.ui.ILaunchConfigurationTab2;
import org.eclipse.debug.ui.ILaunchConfigurationTabGroup;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -1239,6 +1241,30 @@ public class LaunchConfigurationTabGroupViewer {
}
/**
+ * Returns the current warning message or <code>null</code> if none.
+ * @return Returns an appropriate warning message for display to user. The message returned will be:
+ * The warning message defined by the visible tab
+ * or <code>null</code> if no message is defined
+ */
+ public String getWarningMessage() {
+ if (fInitializingTabs) {
+ return null;
+ }
+
+ String message = null;
+
+ ILaunchConfigurationTab tab = getActiveTab();
+ if (tab instanceof ILaunchConfigurationTab2) {
+ String tabMessage = ((ILaunchConfigurationTab2)tab).getWarningMessage();
+ if (tabMessage != null) {
+ message = tabMessage;
+ }
+ }
+
+ return message;
+ }
+
+ /**
* Verify that the launch configuration name is valid.
* @throws CoreException if a name conflict occurs
*/
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index 1b608c2..a3d6ee9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Sebastian Davids - Bug 137923
+ * Mohamed Hussein (Mentor Graphics) - Added s/getWarningMessage (Bug 386673)
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
@@ -47,6 +48,7 @@ import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -1526,7 +1528,11 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
public void updateMessage() {
if (!fSettingInput) {
setErrorMessage(fTabViewer.getErrorMesssage());
- setMessage(fTabViewer.getMessage());
+ if (fTabViewer.getWarningMessage() != null) {
+ setMessage(fTabViewer.getWarningMessage(), IMessageProvider.WARNING);
+ } else {
+ setMessage(fTabViewer.getMessage());
+ }
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java
index c9f05cd..dd4e445 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Mohamed Hussein (Mentor Graphics) - Added s/getWarningMessage (Bug 386673)
*******************************************************************************/
package org.eclipse.debug.ui;
@@ -39,7 +40,7 @@ import org.eclipse.ui.progress.WorkbenchJob;
* @see ILaunchConfigurationTab
* @since 2.0
*/
-public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigurationTab {
+public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigurationTab2 {
/**
* The control for this page, or <code>null</code>
@@ -58,6 +59,11 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura
private String fErrorMessage;
/**
+ * Current warning message, or <code>null</code>
+ */
+ private String fWarningMessage;
+
+ /**
* Current message, or <code>null</code>
*/
private String fMessage;
@@ -133,6 +139,14 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura
}
/**
+ * @see ILaunchConfigurationTab2#getWarningMessage()
+ * @since 3.9
+ */
+ public String getWarningMessage() {
+ return fWarningMessage;
+ }
+
+ /**
* @see ILaunchConfigurationTab#getMessage()
*/
public String getMessage() {
@@ -168,6 +182,16 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura
}
/**
+ * Sets this page's warning message, possibly <code>null</code>.
+ *
+ * @param warningMessage the warning message or <code>null</code>
+ * @since 3.9
+ */
+ protected void setWarningMessage(String warningMessage) {
+ fWarningMessage = warningMessage;
+ }
+
+ /**
* Sets this page's message, possibly <code>null</code>.
*
* @param message the message or <code>null</code>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab2.java
new file mode 100644
index 0000000..b019f87
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab2.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Mentor Graphics Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mohamed Hussein (Mentor Graphics) - initial API and implementation (Bug 386673)
+ *******************************************************************************/
+package org.eclipse.debug.ui;
+
+/**
+ * Optional enhancements for {@link ILaunchConfigurationTab}.
+ * @since 3.9
+ */
+public interface ILaunchConfigurationTab2 extends ILaunchConfigurationTab {
+
+ /**
+ * Returns a warning message to be displayed to the user
+ * or <code>null</code> if none is present.
+ * @return Returns a warning message to be displayed to the user
+ * or <code>null</code> if none is present.
+ */
+ public String getWarningMessage();
+} \ No newline at end of file