Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java')
-rw-r--r--sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java54
1 files changed, 26 insertions, 28 deletions
diff --git a/sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java b/sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java
index 1c6bc8a1b5e..40e2ee36717 100644
--- a/sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java
+++ b/sandbox/org.eclipse.papyrus.dev.project.management/src/org/eclipse/papyrus/dev/project/management/handlers/features/AddFEPLFileHandler.java
@@ -1,19 +1,13 @@
package org.eclipse.papyrus.dev.project.management.handlers.features;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.dev.project.management.Activator;
import org.eclipse.papyrus.dev.project.management.handlers.AbstractAddFileHandler;
import org.eclipse.papyrus.dev.project.management.utils.Utils;
-import org.eclipse.swt.widgets.Display;
public class AddFEPLFileHandler extends AbstractAddFileHandler {
@@ -22,29 +16,33 @@ public class AddFEPLFileHandler extends AbstractAddFileHandler {
public static final String EPL_HTML_PATH = "epl-v10.html"; //$NON-NLS-1$
- private static URL epl_url;
-
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for(final IProject current : projects) {
- if(current.isOpen()) {
- try {
- if(current.hasNature(Utils.FEATURE_NATURE)) {
- if(epl_url == null) {
- epl_url = new URL("platform:/plugin/" + Activator.PLUGIN_ID + EPL_HTML_SOURCE_PATH); //$NON-NLS-1$
- }
- addFile(current, epl_url, EPL_HTML_PATH);
- }
- } catch (final CoreException e) {
- Activator.log.error(e);
- } catch (final MalformedURLException e) {
- Activator.log.error(e);
- } catch (final IOException e) {
- Activator.log.error(e);
- }
- }
+ @Override
+ protected boolean isValidProject(IProject current) {
+ try {
+ return current.hasNature(Utils.FEATURE_NATURE);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ }
+ return false;
+ }
+
+ @Override
+ protected URL getSourceURL() {
+ try {
+ return new URL("platform:/plugin/" + Activator.PLUGIN_ID + EPL_HTML_SOURCE_PATH); //$NON-NLS-1$
+ } catch (MalformedURLException ex) {
+ Activator.log.error(ex);
}
- new MessageDialog(Display.getCurrent().getActiveShell(), "Add about.html file", null, "Done.", MessageDialog.INFORMATION, new String[]{ "OK" }, 0).open();
return null;
}
+
+ @Override
+ protected String getTargetPath() {
+ return EPL_HTML_PATH;
+ }
+
+ @Override
+ protected String getJobName() {
+ return "Add EPL file";
+ }
}

Back to the top