1 11 package org.eclipse.pde.internal.ui.launcher; 12 13 import org.eclipse.debug.core.*; 14 import org.eclipse.debug.ui.*; 15 import org.eclipse.swt.widgets.*; 16 import org.eclipse.core.runtime.*; 17 import org.eclipse.pde.internal.ui.PDEPlugin; 18 import org.eclipse.swt.layout.GridData; 19 import org.eclipse.swt.SWT; 20 21 25 public abstract class AbstractLauncherTab extends AbstractLaunchConfigurationTab { 26 27 protected void createStartingSpace(Composite parent, int span) { 28 Label label = new Label(parent, SWT.NULL); 29 GridData data = new GridData(); 30 data.horizontalSpan = span; 31 label.setLayoutData(data); 32 } 33 34 public boolean isValid(ILaunchConfiguration config) { 35 return getErrorMessage() == null; 36 } 37 38 41 public void activated(ILaunchConfigurationWorkingCopy workingCopy) { 42 } 43 44 47 public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { 48 } 49 50 53 protected void updateStatus(IStatus status) { 54 applyToStatusLine(this, status); 55 } 56 57 60 public static void applyToStatusLine(AbstractLauncherTab tab, IStatus status) { 61 String errorMessage= null; 62 String warningMessage= null; 63 String statusMessage= status.getMessage(); 64 if (statusMessage.length() > 0) { 65 if (status.matches(IStatus.ERROR)) { 66 errorMessage= statusMessage; 67 } else if (!status.isOK()) { 68 warningMessage= statusMessage; 69 } 70 } 71 tab.setErrorMessage(errorMessage); 72 tab.setMessage(warningMessage); 73 tab.updateLaunchConfigurationDialog(); 74 } 75 76 public static IStatus getMoreSevere(IStatus s1, IStatus s2) { 77 return (s1.getSeverity() >= s2.getSeverity()) ? s1 : s2; 78 } 79 80 public static IStatus createStatus(int severity, String message) { 81 return new Status(severity, PDEPlugin.getPluginId(), severity, message, null); 82 } 83 84 87 protected void updateLaunchConfigurationDialog() { 88 super.updateLaunchConfigurationDialog(); 89 } 90 91 } 92 | Popular Tags |