diff options
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 1aef3d1ad..862a5550e 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 27b3a2fcc..ea854dad9 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 261b3f665..7f4b2bb53 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 1b608c2b3..a3d6ee978 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 c9f05cd20..dd4e4456c 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 000000000..b019f87fb --- /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 |