Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2017-10-11 15:12:27 +0000
committervincent lorenzo2017-10-16 11:21:40 +0000
commit0cc06c2b578a43a59318327c2840812a2c863ac6 (patch)
treea490ee14d3875988ae5a89bb8b38610f8107558b
parent30b6ae2349087dfd551c9610917a48e8099b715a (diff)
downloadorg.eclipse.papyrus-0cc06c2b578a43a59318327c2840812a2c863ac6.tar.gz
org.eclipse.papyrus-0cc06c2b578a43a59318327c2840812a2c863ac6.tar.xz
org.eclipse.papyrus-0cc06c2b578a43a59318327c2840812a2c863ac6.zip
Bug 525876: [ProjectEditors] Add methods to papyrus projects editors
Change-Id: Ib4182d0c59257b0d2ec452e61baaed927f5413e8 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF5
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml2
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java53
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java63
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java33
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java78
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginEditor.java69
-rwxr-xr-xplugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/filter/JavaPluginProjectFilter.java54
8 files changed, 336 insertions, 21 deletions
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
index 4f5ab1f23bd..65c548e3098 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
@@ -1,14 +1,15 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.eclipse.project.editors.file,
org.eclipse.papyrus.eclipse.project.editors.interfaces,
- org.eclipse.papyrus.eclipse.project.editors.project
+ org.eclipse.papyrus.eclipse.project.editors.project,
+ org.eclipse.papyrus.eclipse.project.editors.project.filter
Require-Bundle: org.eclipse.jdt.core;bundle-version="[3.12.0,4.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)",
org.eclipse.pde.core;bundle-version="[3.11.0,4.0.0)";visibility:=reexport,
org.eclipse.pde.ui;bundle-version="[3.9.0,4.0.0)"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.1.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.eclipse.project.editors.Activator
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml
index 5e88c787d88..39b9bb277e2 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.eclipse.project.editors</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
index b191b1da17a..592e56b0be8 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus - bugs 485220, 489075
- *
+ * Vincent Lorenzo (CEA LIST) - bug 525876
*****************************************************************************/
package org.eclipse.papyrus.eclipse.project.editors.file;
@@ -71,10 +71,12 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
private static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName"; //$NON-NLS-1$
- private static final String IMPORT_PACKAGE = "Import-Package";
+ private static final String IMPORT_PACKAGE = "Import-Package"; //$NON-NLS-1$
- private static final String EXPORT_PACKAGE = "Export-Package";
+ private static final String EXPORT_PACKAGE = "Export-Package"; //$NON-NLS-1$
+ private static final String FRAGMENT_HOST = "Fragment-Host"; //$NON-NLS-1$
+
private static final String SINGLETON = "singleton:="; //$NON-NLS-1$
private static final String VISIBILITY = "visibility"; //$NON-NLS-1$
@@ -187,7 +189,7 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
public void setDependenciesVersion(final String dependencyPattern, final String newVersion) {
updateDependencies(
name -> name.contains(dependencyPattern), // Update dependencies like this
- Collections.singletonMap("bundle-version", newVersion), // To have this version attribute
+ Collections.singletonMap("bundle-version", newVersion), // To have this version attribute //$NON-NLS-1$
null); // And don't change directives such as optionality
}
@@ -204,7 +206,7 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
// 1 - the attribute/directive name
// 2 - the equality/assignment operator
// 3 - the quotation delimiter, if any
- Pattern attributeOrDirective = Pattern.compile("([^:]+)(:?=)([\"']?).*\\3");
+ Pattern attributeOrDirective = Pattern.compile("([^:]+)(:?=)([\"']?).*\\3"); //$NON-NLS-1$
transformHeader(headerName, predicate, (dependency, attrs) -> {
StringBuilder result = new StringBuilder();
@@ -968,4 +970,43 @@ public class ManifestEditor extends ProjectEditor implements IManifestEditor {
return attributeNames;
}
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setFragmentHost(java.lang.String)
+ */
+ @Override
+ public void setFragmentHost(final String fragmentHost) {
+ setFragmentHost(fragmentHost, null);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setFragmentHost(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void setFragmentHost(final String fragmentHost, final String version) {
+ String fragmentHostStringValue = (version == null)
+ ? fragmentHost
+ : String.format("%s;version=\"%s\"", fragmentHost, version); //$NON-NLS-1$
+
+ setMainAttribute(FRAGMENT_HOST, fragmentHostStringValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#getFragmentHost()
+ */
+ @Override
+ public String getFragmentHost() {
+ // Without the <String> hint, javac balks but JDT does not
+ return getMainAttribute(FRAGMENT_HOST)
+ .<String> map(name -> {
+ int semiColon = name.indexOf(SEMICOLON);
+ return semiColon >= 0 ? name.substring(0, semiColon) : name;
+ }).orElse(null);
+ }
}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java
index 73bd98dc743..0c20f070c25 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,10 +9,14 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ * Vincent Lorenzo (CEA LIST) - bug 525876
*****************************************************************************/
package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+
/**
*
* Editor for the java project
@@ -29,6 +33,27 @@ public interface IJavaProjectEditor extends IProjectEditor, IBuildEditor, IClass
public static final String JAVA_BUILD_COMMAND = "org.eclipse.jdt.core.javabuilder"; //$NON-NLS-1$
/**
+ * The class file extension.
+ *
+ * @since 2.1
+ */
+ public static final String CLASS_FILE_EXTENSION = ".java"; //$NON-NLS-1$
+
+ /**
+ * The basic source folder name.
+ *
+ * @since 2.1
+ */
+ public static final String BASIC_SOURCE_FOLDER_NAME = "src"; //$NON-NLS-1$
+
+ /**
+ * The basic bin folder name.
+ *
+ * @since 2.1
+ */
+ public static final String BASIC_BIN_FOLDER_NAME = "bin"; //$NON-NLS-1$
+
+ /**
* Add a new java source folder in the .classpath and in the build.properties
*
* @param path
@@ -36,4 +61,38 @@ public interface IJavaProjectEditor extends IProjectEditor, IBuildEditor, IClass
*/
public void addJavaSourceFolder(final String path);
+ /**
+ * Add a new package in the java project.
+ *
+ * @param sourceFolderName
+ * the name of the source folder where the package will be added
+ * @param packageName
+ * The package name.
+ * @since 2.1
+ */
+ public IPackageFragment addPackage(final String sourceFolderName, final String packageName);
+
+ /**
+ * Add a class in a package.
+ *
+ * @param sourceFolderName
+ * the source folder name
+ * @param packageName
+ * The package name.
+ * @param className
+ * The class name.
+ * @param content
+ * The class content.
+ * @since 2.1
+ */
+ public ICompilationUnit addClass(final String sourceFolderName, final String packageName, final String className, final String content);
+
+ /**
+ * Get the current java project.
+ *
+ * @return the current java project.
+ * @since 2.1
+ */
+ public IJavaProject getJavaProject();
+
}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java
index 73e5fef8183..d784d6883df 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,7 +10,7 @@
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr
* Christian W. Damus - bug 485220
- *
+ * Vincent Lorenzo (CEA LIST) - bug 525876
*****************************************************************************/
package org.eclipse.papyrus.eclipse.project.editors.interfaces;
@@ -319,4 +319,33 @@ public interface IManifestEditor extends IProjectEditor, IFileEditor {
*/
public void removeImportedPackage(String packageName);
+ /**
+ * Set the fragment host of the bundle.
+ *
+ * @param name
+ * The fragment host for the bundle
+ * @since 2.1
+ */
+ public void setFragmentHost(final String fragmentHost);
+
+ /**
+ * Set the fragment host of the bundle.
+ *
+ * @param name
+ * The fragment host for the bundle
+ * @param version
+ * The fragment version
+ * @since 2.1
+ */
+ public void setFragmentHost(final String fragmentHost, final String version);
+
+
+ /**
+ * Get the fragment host for the bundle.
+ *
+ * @return
+ * The fragment host of the bundle.
+ * @since 2.1
+ */
+ public String getFragmentHost();
}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
index f76d2f5213d..81bfa0b14f2 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,16 +9,19 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ * Vincent Lorenzo (CEA LIST) - bug 525876
*****************************************************************************/
package org.eclipse.papyrus.eclipse.project.editors.project;
import java.util.Set;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.papyrus.eclipse.project.editors.Activator;
@@ -39,8 +42,6 @@ public class JavaProjectEditor extends ProjectEditor implements IJavaProjectEdit
/** the java project */
private final IJavaProject javaProject;
-
-
/**
* Gets the classpath editor.
*
@@ -174,16 +175,71 @@ public class JavaProjectEditor extends ProjectEditor implements IJavaProjectEdit
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#addPackage(String, java.lang.String)
+ */
+ @Override
+ public IPackageFragment addPackage(final String sourceFolderName, final String packageName) {
+ IPackageFragment createdPackage = null;
+ if (exists()) {
+ touch();
+
+ IFolder sourceFolder = null;
+ if (null != sourceFolderName && !sourceFolderName.isEmpty() && this.classpathEditor.isSourceFolderRegistered(sourceFolderName)) {
+ sourceFolder = javaProject.getProject().getFolder(sourceFolderName);
+ } else {
+ final String[] sourceFolders = this.classpathEditor.getSourceFolders();
+ if (sourceFolders.length > 0) {
+ sourceFolder = javaProject.getProject().getFolder(sourceFolders[0]);
+ }
+ }
+ if (null != sourceFolder) {
+ createdPackage = javaProject.getPackageFragmentRoot(sourceFolder).getPackageFragment(packageName);
+ if (null == createdPackage || !createdPackage.exists()) {
+ try {
+ createdPackage = javaProject.getPackageFragmentRoot(sourceFolder).createPackageFragment(packageName, false, null);
+ } catch (final JavaModelException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+ return createdPackage;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#addClass(String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public ICompilationUnit addClass(String sourceFolderName, final String packageName, final String className, final String content) {
+ ICompilationUnit createdClass = null;
+ if (exists()) {
+ touch();
+
+ final IPackageFragment packageFragment = addPackage(sourceFolderName, packageName);
+ try {
+ createdClass = packageFragment.createCompilationUnit(className + CLASS_FILE_EXTENSION, content, false, null);
+ } catch (final JavaModelException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ return createdClass;
+ }
+
@Override
public void registerSourceFolder(final String string) {
this.buildEditor.registerSourceFolder(string);
-
}
@Override
public void addToBuild(final String path) {
this.buildEditor.addToBuild(path);
-
}
@Override
@@ -256,4 +312,14 @@ public class JavaProjectEditor extends ProjectEditor implements IJavaProjectEdit
public String[] getBinFolders() {
return classpathEditor.getBinFolders();
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#getJavaProject()
+ */
+ @Override
+ public IJavaProject getJavaProject() {
+ return javaProject;
+ }
}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginEditor.java
index 143d73c1b65..eb7fe36c93c 100644
--- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginEditor.java
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus - bug 485220
- *
+ * Vincent Lorenzo (CEA LIST) - bug 525876
*****************************************************************************/
package org.eclipse.papyrus.eclipse.project.editors.project;
@@ -21,6 +21,9 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.papyrus.eclipse.project.editors.file.ManifestEditor;
import org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor;
import org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor;
@@ -356,6 +359,27 @@ public class PluginEditor extends PluginProjectEditor implements IPluginEditor {
public void addSourceFolderToClasspath(String srcPath, String binPath) {
java.addSourceFolderToClasspath(srcPath, binPath);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#addPackage(String, java.lang.String)
+ */
+ @Override
+ public IPackageFragment addPackage(String sourceFolderName, final String packageName) {
+ return java.addPackage(sourceFolderName, packageName);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#addClass(String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ @Override
+ public ICompilationUnit addClass(String sourceFolderName, final String packageName, final String className, final String classContent) {
+ return java.addClass(sourceFolderName, packageName, className, classContent);
+ }
+
@Override
public boolean isSourceFolderRegistered(String folderPath) {
@@ -366,4 +390,45 @@ public class PluginEditor extends PluginProjectEditor implements IPluginEditor {
public String[] getBinFolders() {
return java.getBinFolders();
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#getJavaProject()
+ */
+ @Override
+ public IJavaProject getJavaProject() {
+ return java.getJavaProject();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setFragmentHost(java.lang.String)
+ */
+ @Override
+ public void setFragmentHost(final String fragmentHost) {
+ manifest.setFragmentHost(fragmentHost);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setFragmentHost(java.lang.String, java.lang.String)
+ */
+ @Override
+ public void setFragmentHost(final String fragmentHost, final String version) {
+ manifest.setFragmentHost(fragmentHost, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#getFragmentHost()
+ */
+ @Override
+ public String getFragmentHost() {
+ return manifest.getFragmentHost();
+ }
+
}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/filter/JavaPluginProjectFilter.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/filter/JavaPluginProjectFilter.java
new file mode 100755
index 00000000000..cf8f167a369
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/filter/JavaPluginProjectFilter.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.eclipse.project.editors.project.filter;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor;
+
+/**
+ *
+ * Filter used to find java plugin project in the workspace
+ *
+ * @since 2.1
+ */
+public class JavaPluginProjectFilter extends ViewerFilter {
+
+ /**
+ *
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param parentElement
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean select(final Viewer viewer, final Object parentElement, final Object element) {
+ if (element instanceof IProject) {
+ final IProject project = ((IProject) element).getProject();
+ if (project.exists() && project.isOpen()) {
+ try {
+ return project.hasNature(IJavaProjectEditor.JAVA_NATURE) && project.hasNature(IPluginProjectEditor.PLUGIN_NATURE);
+ } catch (final CoreException e) {
+ // nothing to do here, we already check if the project exists and is open
+ }
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file

Back to the top