diff options
author | vladt | 2011-03-09 21:09:19 +0000 |
---|---|---|
committer | vladt | 2011-03-09 21:09:19 +0000 |
commit | f54bd359e4022332c2e2eaeb1be823e207c5e940 (patch) | |
tree | ccae37917038c8f7568682e497e1b73fe6965907 | |
parent | cf678f7491ccffeace464925ca53c80f68449b3c (diff) | |
download | m2e-core-f54bd359e4022332c2e2eaeb1be823e207c5e940.tar.gz m2e-core-f54bd359e4022332c2e2eaeb1be823e207c5e940.tar.xz m2e-core-f54bd359e4022332c2e2eaeb1be823e207c5e940.zip |
Cleanup
8 files changed, 94 insertions, 134 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java index 754f8d74..dc8cb2c5 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java @@ -474,15 +474,13 @@ public class ProjectRegistryManager { MavenExecutionRequest mavenRequest = getConfiguredExecutionRequest(context, newState, newFacade.getPom(), newFacade.getResolverConfiguration()); - List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>(); - LifecycleMappingResult mappingResult = LifecycleMappingFactory.calculateLifecycleMapping(mavenRequest, newFacade, monitor); newFacade.setLifecycleMappingId(mappingResult.getLifecycleMappingId()); newFacade.setMojoExecutionMapping(mappingResult.getMojoExecutionMapping()); - // XXX reconsile with corresponding LifecycleMappingFactory methods + // XXX reconcile with corresponding LifecycleMappingFactory methods newFacade.setSessionProperty(MavenProjectFacade.PROP_LIFECYCLE_MAPPING, mappingResult.getLifecycleMapping()); newFacade.setSessionProperty(MavenProjectFacade.PROP_CONFIGURATORS, mappingResult.getProjectConfigurators()); diff --git a/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/ContextMenuHelper.java b/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/ContextMenuHelper.java index 3dd36b21..6c20407c 100644 --- a/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/ContextMenuHelper.java +++ b/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/ContextMenuHelper.java @@ -17,6 +17,8 @@ import static org.hamcrest.Matchers.instanceOf; import java.util.Arrays; +import org.hamcrest.Matcher; + import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; @@ -28,7 +30,6 @@ import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable; import org.eclipse.swtbot.swt.finder.results.VoidResult; import org.eclipse.swtbot.swt.finder.results.WidgetResult; import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot; -import org.hamcrest.Matcher; public class ContextMenuHelper { @@ -91,7 +92,7 @@ public class ContextMenuHelper { */ public static void clickContextMenu( final AbstractSWTBot<? extends Control> bot, final String... texts) { - Matcher<? extends Widget>[] matchers = new Matcher[texts.length]; + Matcher<Widget>[] matchers = new Matcher[texts.length]; for (int i = 0; i < texts.length; i++) { matchers[i] = withMnemonic(texts[i]); } diff --git a/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/SonatypeSWTBot.java b/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/SonatypeSWTBot.java index 7c08eea6..1221c1f6 100644 --- a/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/SonatypeSWTBot.java +++ b/org.eclipse.m2e.integration.tests.common/src/org/eclipse/m2e/integration/tests/common/SonatypeSWTBot.java @@ -18,10 +18,13 @@ import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withLa import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withStyle; import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withText; +import org.hamcrest.Matcher; + import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; import org.eclipse.swtbot.swt.finder.widgets.SWTBotCCombo; import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; @@ -29,103 +32,83 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; import org.eclipse.ui.forms.widgets.Hyperlink; import org.eclipse.ui.forms.widgets.Section; -import org.hamcrest.Matcher; - -public class SonatypeSWTBot - extends SWTWorkbenchBot -{ - - public SWTBotText textWithName( String value ) - { - return textWithName( value, 0 ); - } - - @SuppressWarnings( "unchecked" ) - public SWTBotText textWithName( String value, int index ) - { - Matcher matcher = allOf( widgetOfType( Text.class ), withId( "name", value ) ); - return new SWTBotText( (Text) widget( matcher, index ), matcher ); - } - - public SWTBotCheckBox checkBoxWithName( String name ) - { - return checkBoxWithName( name, 0 ); - } - - @SuppressWarnings( "unchecked" ) - public SWTBotCCombo ccomboBoxWithName( String value, int index ) - { - Matcher matcher = allOf( widgetOfType( CCombo.class ), withId( "name", value ) ); - return new SWTBotCCombo( (CCombo) widget( matcher, index ), matcher ); - } - - public SWTBotCCombo ccomboBoxWithName( String value ) - { - return ccomboBoxWithName( value, 0 ); - } - - @SuppressWarnings( "unchecked" ) - public SWTBotCheckBox checkBoxWithName( String name, int index ) - { - Matcher matcher = - allOf( widgetOfType( Button.class ), withId( "name", name ), withStyle( SWT.CHECK, "SWT.CHECK" ) ); - return new SWTBotCheckBox( (Button) widget( matcher, index ), matcher ); - } - @SuppressWarnings( "unchecked" ) - public HyperlinkBot hyperlink( String text ) - { - return new HyperlinkBot( (Hyperlink) widget( allOf( widgetOfType( Hyperlink.class ), withText( text ) ) ) ); - } - @SuppressWarnings( "unchecked" ) - public HyperlinkBot hyperlinkWithLabel( String label ) - { - return new HyperlinkBot( (Hyperlink) widget( allOf( widgetOfType( Hyperlink.class ), withLabel( label ) ) ) ); +public class SonatypeSWTBot extends SWTWorkbenchBot { + + public SWTBotText textWithName(String value) { + return textWithName(value, 0); + } + + @SuppressWarnings("unchecked") + public SWTBotText textWithName(String value, int index) { + Matcher<Widget> matcher = allOf(widgetOfType(Text.class), withId("name", value)); + return new SWTBotText((Text) widget(matcher, index), matcher); + } + + public SWTBotCheckBox checkBoxWithName(String name) { + return checkBoxWithName(name, 0); + } + + @SuppressWarnings("unchecked") + public SWTBotCCombo ccomboBoxWithName(String value, int index) { + Matcher<Widget> matcher = allOf(widgetOfType(CCombo.class), withId("name", value)); + return new SWTBotCCombo((CCombo) widget(matcher, index), matcher); + } + + public SWTBotCCombo ccomboBoxWithName(String value) { + return ccomboBoxWithName(value, 0); + } + + @SuppressWarnings("unchecked") + public SWTBotCheckBox checkBoxWithName(String name, int index) { + Matcher<Widget> matcher = allOf(widgetOfType(Button.class), withId("name", name), withStyle(SWT.CHECK, "SWT.CHECK")); + return new SWTBotCheckBox((Button) widget(matcher, index), matcher); + } + + @SuppressWarnings("unchecked") + public HyperlinkBot hyperlink(String text) { + return new HyperlinkBot((Hyperlink) widget(allOf(widgetOfType(Hyperlink.class), withText(text)))); + } + + @SuppressWarnings("unchecked") + public HyperlinkBot hyperlinkWithLabel(String label) { + return new HyperlinkBot((Hyperlink) widget(allOf(widgetOfType(Hyperlink.class), withLabel(label)))); + } + + @SuppressWarnings("unchecked") + public SectionBot section(String title) { + return new SectionBot((Section) widget(allOf(widgetOfType(Section.class), withText(title)))); + } + + @SuppressWarnings("unchecked") + public SectionBot sectionWithName(String value) { + return new SectionBot((Section) widget(allOf(widgetOfType(Section.class), withId("name", value)))); + } + + public boolean waitForShellToClose(String title) { + SWTBotShell shell = activeShell(); + if(title != null && title.equals(shell.getText())) { + return waitForShellToClose(shell); } - - @SuppressWarnings( "unchecked" ) - public SectionBot section( String title ) - { - return new SectionBot( (Section) widget( allOf( widgetOfType( Section.class ), withText( title ) ) ) ); - } - - @SuppressWarnings( "unchecked" ) - public SectionBot sectionWithName( String value ) - { - return new SectionBot( (Section) widget( allOf( widgetOfType( Section.class ), withId( "name", value ) ) ) ); - } - - public boolean waitForShellToClose( String title ) - { - SWTBotShell shell = activeShell(); - if ( title != null && title.equals( shell.getText() ) ) - { - return waitForShellToClose( shell ); - } - return false; - } - - public boolean waitForShellToClose( SWTBotShell shell ) - { - if ( shell != null ) - { - for ( int i = 0; i < 50; i++ ) - { - if ( !shell.isOpen() ) - { - return true; - } - sleep( 200 ); - } - shell.close(); + return false; + } + + public boolean waitForShellToClose(SWTBotShell shell) { + if(shell != null) { + for(int i = 0; i < 50; i++ ) { + if(!shell.isOpen()) { + return true; } - return false; + sleep(200); + } + shell.close(); } + return false; + } - @Override - public SonatypeSWTBotTree tree() - { - return new SonatypeSWTBotTree( super.tree() ); - } + @Override + public SonatypeSWTBotTree tree() { + return new SonatypeSWTBotTree(super.tree()); + } } diff --git a/org.eclipse.m2e.jdt/plugin.xml b/org.eclipse.m2e.jdt/plugin.xml index 200dd927..ba125093 100644 --- a/org.eclipse.m2e.jdt/plugin.xml +++ b/org.eclipse.m2e.jdt/plugin.xml @@ -453,8 +453,6 @@ menubarPath="org.eclipse.m2e.core.workingSetMenu/update" enablesFor="+"/> </objectContribution> - - <objectContribution id="org.eclipse.m2e.openJavaDocArtifact" objectClass="org.apache.maven.artifact.Artifact" @@ -464,14 +462,6 @@ label="%action.javadoc.label" enablesFor="1" icon="icons/javadoc.gif"/> </objectContribution> - <objectContribution id="org.eclipse.m2e.openJavaDocDependencyNode" - objectClass="org.apache.maven.shared.dependency.tree.DependencyNode" - adaptable="false"> - <action id="org.eclipse.m2e.ui.openJavaDocDependencyNode" - class="org.eclipse.m2e.jdt.internal.actions.OpenJavaDocAction" - label="%action.javadoc2.label" - enablesFor="1" icon="icons/javadoc.gif"/> - </objectContribution> <objectContribution id="org.eclipse.m2e.openJavaDocDependencyNodeAether" objectClass="org.sonatype.aether.graph.DependencyNode" adaptable="false"> diff --git a/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/MavenConsoleAppender.java b/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/MavenConsoleAppender.java index 3b3034a4..d648f5e5 100644 --- a/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/MavenConsoleAppender.java +++ b/org.eclipse.m2e.logback.appender/src/main/java/org/eclipse/m2e/logback/appender/MavenConsoleAppender.java @@ -23,6 +23,7 @@ import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; import org.eclipse.m2e.core.ui.internal.console.MavenConsole; +@SuppressWarnings("restriction") public class MavenConsoleAppender extends UnsynchronizedAppenderBase<ILoggingEvent> { private static final String M2E_CORE_UI_BUNDLE_ID = "org.eclipse.m2e.core.ui"; //$NON-NLS-1$ diff --git a/org.eclipse.m2e.model.edit/src/main/java/org/eclipse/m2e/model/edit/pom/translators/ListAdapter.java b/org.eclipse.m2e.model.edit/src/main/java/org/eclipse/m2e/model/edit/pom/translators/ListAdapter.java index 3d47afec..f3deb3e8 100644 --- a/org.eclipse.m2e.model.edit/src/main/java/org/eclipse/m2e/model/edit/pom/translators/ListAdapter.java +++ b/org.eclipse.m2e.model.edit/src/main/java/org/eclipse/m2e/model/edit/pom/translators/ListAdapter.java @@ -33,8 +33,9 @@ import org.w3c.dom.Text; * @author Mike Poindexter * */ +@SuppressWarnings("restriction") public class ListAdapter extends TranslatorAdapter { - protected List list; + protected List list; private EClass elementType; @@ -63,7 +64,6 @@ public class ListAdapter extends TranslatorAdapter { } } else if (INodeNotifier.REMOVE == eventType && oldValue instanceof Element) { - IDOMElement el = (IDOMElement)oldValue; if (notifier == node) { // Remove the corresponding object from the model. Object o = getObject((Element) oldValue, false); @@ -91,7 +91,6 @@ public class ListAdapter extends TranslatorAdapter { && elementType == null) { if (notifier != node && notifier instanceof Element) { Element e = (Element) notifier; - String name = e.getLocalName(); int idx = absoluteIndexOf(node, e); if (idx < 0) idx = 0; @@ -102,9 +101,7 @@ public class ListAdapter extends TranslatorAdapter { } finally { resource.setProcessEvents(true); } - } - } public void add(Object newValue, int position) { diff --git a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetAction.java b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetAction.java index b0b6f741..d447ccc7 100644 --- a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetAction.java +++ b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetAction.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; @@ -32,7 +31,6 @@ import org.eclipse.ui.PlatformUI; * * @author Milos Kleint */ -@SuppressWarnings("restriction") public class DependencySetAction implements IActionDelegate { public static final String ID = "org.eclipse.m2e.refactoring.DependencySet"; //$NON-NLS-1$ @@ -96,10 +94,6 @@ public class DependencySetAction implements IActionDelegate { } } - private IFile getFileFromProject(IJavaProject javaProject) { - return javaProject.getProject().getFile("pom.xml"); //$NON-NLS-1$ - } - //mkleint: scary private IFile getFileFromEditor() { IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); @@ -109,5 +103,4 @@ public class DependencySetAction implements IActionDelegate { } return null; } - } diff --git a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetRefactoring.java b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetRefactoring.java index e4558095..b2d87bf1 100644 --- a/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetRefactoring.java +++ b/org.eclipse.m2e.refactoring/src/org/eclipse/m2e/refactoring/dependencyset/DependencySetRefactoring.java @@ -10,7 +10,16 @@ *******************************************************************************/ package org.eclipse.m2e.refactoring.dependencyset; -import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.*; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ARTIFACT_ID; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCIES; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCY; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCY_MANAGEMENT; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.GROUP_ID; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.VERSION; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.childEquals; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getChild; +import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText; import java.util.ArrayList; import java.util.List; @@ -23,10 +32,9 @@ import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.Refactoring; import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.m2e.core.embedder.ArtifactKey; +import org.eclipse.m2e.core.ui.internal.editing.PomEdits.CompoundOperation; import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation; import org.eclipse.m2e.core.ui.internal.editing.PomHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -35,17 +43,9 @@ import org.w3c.dom.Element; * */ public class DependencySetRefactoring extends Refactoring { - - private static final Logger LOG = LoggerFactory.getLogger(DependencySetRefactoring.class); private final IFile file; private final List<ArtifactKey> keys; - /** - * @param file - * @param groupId - * @param artifactId - * @param version - */ public DependencySetRefactoring(IFile file, List<ArtifactKey> keys) { this.file = file; this.keys = keys; @@ -120,9 +120,6 @@ public class DependencySetRefactoring extends Refactoring { PomHelper.createDependency(dm, groupId, artifactId, version); } } - } - } - } |