You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2002/10/18 18:51:30 UTC
cvs commit: jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher CactusLaunchShortcut.java
vmassol 2002/10/18 09:51:30
Modified: Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher
CactusLaunchShortcut.java
Log:
reduced number of checkstyle errors
Revision Changes Path
1.3 +46 -63 jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher/CactusLaunchShortcut.java
Index: CactusLaunchShortcut.java
===================================================================
RCS file: /home/cvs/jakarta-cactus/Eclipse-Plugin/src/java/org/apache/cactus/eclipse/launcher/CactusLaunchShortcut.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CactusLaunchShortcut.java 18 Oct 2002 14:47:14 -0000 1.2
+++ CactusLaunchShortcut.java 18 Oct 2002 16:51:30 -0000 1.3
@@ -56,7 +56,6 @@
*/
package org.apache.cactus.eclipse.launcher;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -68,60 +67,41 @@
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.ILaunchShortcut;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.debug.ui.JavaUISourceLocator;
import org.eclipse.jdt.internal.junit.launcher.JUnitBaseLaunchConfiguration;
import org.eclipse.jdt.internal.junit.launcher.JUnitLaunchShortcut;
-import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
-import org.eclipse.jdt.internal.junit.util.TestSearchEngine;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.ui.JavaElementLabelProvider;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
/**
- * @author Julien Ruaux
- *
* This is the LaunchShortcut class used as an extension point by the plugin.
*
* @version $Id$
+ * @author <a href="mailto:jruaux@octo.com">Julien Ruaux</a>
+ * @author <a href="mailto:vmassol@apache.org">Vincent Massol</a>
*/
public class CactusLaunchShortcut extends JUnitLaunchShortcut
{
-
/**
- * Create & return a new configuration based on the specified <code>IType</code>.
+ * Create & return a new configuration based on the specified
+ * <code>IType</code>.
*/
- protected ILaunchConfiguration createConfiguration(IType type)
+ protected ILaunchConfiguration createConfiguration(IType theType)
{
ILaunchConfiguration config = null;
try
{
ILaunchConfigurationType configType = getCactusLaunchConfigType();
- ILaunchConfigurationWorkingCopy wc =
- configType.newInstance(
- null,
- getLaunchManager()
- .generateUniqueLaunchConfigurationNameFrom(
- type.getElementName()));
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
+ getLaunchManager().generateUniqueLaunchConfigurationNameFrom(
+ theType.getElementName()));
wc.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- type.getFullyQualifiedName());
+ theType.getFullyQualifiedName());
wc.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- type.getJavaProject().getElementName());
+ theType.getJavaProject().getElementName());
wc.setAttribute(
IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE,
IDebugUIConstants.PERSPECTIVE_DEFAULT);
@@ -131,11 +111,11 @@
wc.setAttribute(
ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID,
JavaUISourceLocator.ID_PROMPTING_JAVA_SOURCE_LOCATOR);
- wc.setAttribute(
- JUnitBaseLaunchConfiguration.ATTR_KEEPRUNNING,
+ wc.setAttribute(JUnitBaseLaunchConfiguration.ATTR_KEEPRUNNING,
false);
config = wc.doSave();
- } catch (CoreException ce)
+ }
+ catch (CoreException ce)
{
CactusPlugin.log(ce);
}
@@ -143,63 +123,66 @@
}
/**
- * Locate a configuration to relaunch for the given type. If one cannot be found, create one.
+ * Locate a configuration to relaunch for the given type. If one cannot
+ * be found, create one.
*
* @return a re-useable config or <code>null</code> if none
*/
- protected ILaunchConfiguration findLaunchConfiguration(
- IType type,
- String mode)
+ protected ILaunchConfiguration findLaunchConfiguration(IType theType,
+ String theMode)
{
ILaunchConfigurationType configType = getCactusLaunchConfigType();
List candidateConfigs = Collections.EMPTY_LIST;
+
try
{
ILaunchConfiguration[] configs =
getLaunchManager().getLaunchConfigurations(configType);
+
candidateConfigs = new ArrayList(configs.length);
+
for (int i = 0; i < configs.length; i++)
{
ILaunchConfiguration config = configs[i];
- if (config
- .getAttribute(
- IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- "")
- .equals(type.getFullyQualifiedName()))
- { //$NON-NLS-1$
- if (config
- .getAttribute(
- IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- "")
- .equals(type.getJavaProject().getElementName()))
- { //$NON-NLS-1$
+ if (config.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "")
+ .equals(theType.getFullyQualifiedName()))
+ {
+ if (config.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "")
+ .equals(theType.getJavaProject().getElementName()))
+ {
candidateConfigs.add(config);
}
}
}
- } catch (CoreException e)
+ }
+ catch (CoreException e)
{
CactusPlugin.log(e);
}
- // If there are no existing configs associated with the IType, create one.
- // If there is exactly one config associated with the IType, return it.
- // Otherwise, if there is more than one config associated with the IType, prompt the
- // user to choose one.
+ // If there are no existing configs associated with the IType, create
+ // one. If there is exactly one config associated with the IType,
+ // return it. Otherwise, if there is more than one config associated
+ // with the IType, prompt the user to choose one.
int candidateCount = candidateConfigs.size();
if (candidateCount < 1)
{
- return createConfiguration(type);
- } else if (candidateCount == 1)
+ return createConfiguration(theType);
+ }
+ else if (candidateCount == 1)
{
return (ILaunchConfiguration) candidateConfigs.get(0);
- } else
+ }
+ else
{
- // Prompt the user to choose a config. A null result means the user
- // cancelled the dialog, in which case this method returns null,
- // since cancelling the dialog should also cancel launching anything.
- ILaunchConfiguration config =
- chooseConfiguration(candidateConfigs, mode);
+ // Prompt the user to choose a config. A null result means the
+ // user cancelled the dialog, in which case this method returns
+ // null, since cancelling the dialog should also cancel launching
+ // anything.
+ ILaunchConfiguration config = chooseConfiguration(
+ candidateConfigs, theMode);
if (config != null)
{
return config;
@@ -209,7 +192,7 @@
}
/**
- * Returns the local java launch config type
+ * @return the local java launch config type
*/
protected ILaunchConfigurationType getCactusLaunchConfigType()
{
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>