Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-03-16 07:32:09 +0000
committerFred Bricon2018-03-16 14:26:12 +0000
commit488950756d0040364f3f035ad9082e7b8b5cc9f4 (patch)
treec312f5a3399dd55cb3c3b43ae7da962b85a20c64 /org.eclipse.m2e.launching
parent3577a5b0ba689c14546546902057944b0287aae1 (diff)
downloadm2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.tar.gz
m2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.tar.xz
m2e-core-488950756d0040364f3f035ad9082e7b8b5cc9f4.zip
Generify getAdapter implementations.
Change-Id: Ib87da833039e5aa3d3d7ea01ab637e4100ecd4d0 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.m2e.launching')
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java6
-rw-r--r--org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java14
2 files changed, 7 insertions, 13 deletions
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
index 80209d04..d935ea21 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2018 Sonatype, Inc. 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
@@ -286,8 +286,8 @@ public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension {
for(ILaunchConfiguration configuration : launchConfigurations) {
try {
// substitute variables (may throw exceptions)
- String workDir = LaunchingUtils.substituteVar(configuration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR,
- (String) null));
+ String workDir = LaunchingUtils
+ .substituteVar(configuration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR, (String) null));
if(workDir == null) {
continue;
}
diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
index 0bb3b970..e82d6dbe 100644
--- a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
+++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2018 Sonatype, Inc. 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
@@ -83,8 +83,7 @@ public class MavenFileEditorInput implements IStorageEditorInput {
return false;
}
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return null;
}
};
@@ -104,14 +103,9 @@ public class MavenFileEditorInput implements IStorageEditorInput {
// };
}
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
if(adapter == ILocationProvider.class) {
- return new ILocationProvider() {
- public IPath getPath(Object element) {
- return Path.fromOSString(fileName);
- }
- };
+ return adapter.cast((ILocationProvider) element -> Path.fromOSString(fileName));
}
return null;
}

Back to the top