Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 12:17:28 +0000
committercletavernie2011-10-25 12:17:28 +0000
commit9bcaee93067308eb4f287bbdfbce1b9e03fe2f42 (patch)
treed41cb4c1013e265baed69038ce0e0d6128ae2dd2 /plugins/core
parent8933986ed00f5e1f2c18d5a4c0b81552e4b4e4ec (diff)
downloadorg.eclipse.papyrus-9bcaee93067308eb4f287bbdfbce1b9e03fe2f42.tar.gz
org.eclipse.papyrus-9bcaee93067308eb4f287bbdfbce1b9e03fe2f42.tar.xz
org.eclipse.papyrus-9bcaee93067308eb4f287bbdfbce1b9e03fe2f42.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/core')
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/.classpath7
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/.project28
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/META-INF/MANIFEST.MF15
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/OSGI-INF/l10n/bundle.properties4
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/about.html28
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/build.properties7
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/plugin.properties12
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/plugin.xml48
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/Activator.java70
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DeleteModelParticipant.java147
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DirtyEditorChange.java146
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/Messages.java66
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ModelParticipantHelpers.java152
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/MoveModelParticipant.java117
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelChange.java443
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelParticipant.java142
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties19
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/IScopeChooser.java50
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/Messages.java35
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/RenameParticipantsDialog.java246
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/ScopeChooser.java99
-rw-r--r--plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/messages.properties10
23 files changed, 0 insertions, 1899 deletions
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/.classpath b/plugins/core/org.eclipse.papyrus.ui.resources/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/.project b/plugins/core/org.eclipse.papyrus.ui.resources/.project
deleted file mode 100644
index 72f62f5283f..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.ui.resources</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/.settings/org.eclipse.jdt.core.prefs b/plugins/core/org.eclipse.papyrus.ui.resources/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 91065e4f9d7..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Tue May 31 14:52:21 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.ui.resources/META-INF/MANIFEST.MF
deleted file mode 100644
index d4b14aa455b..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,15 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.ui.resources;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.ui.resources.Activator
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.core;bundle-version="0.8.0";visibility:=reexport,
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
- org.eclipse.papyrus.controlmode,
- org.eclipse.papyrus.controlmode.history
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/OSGI-INF/l10n/bundle.properties b/plugins/core/org.eclipse.papyrus.ui.resources/OSGI-INF/l10n/bundle.properties
deleted file mode 100644
index b7cbe34891d..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/OSGI-INF/l10n/bundle.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Properties file for org.eclipse.papyrus.ui.resources
-renameParticipant.name = Papyrus Model Renaming
-deleteParticipant.name = Papyrus Model deleting
-moveParticipant.name = Papyrus Model Moving \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/about.html b/plugins/core/org.eclipse.papyrus.ui.resources/about.html
deleted file mode 100644
index 209103075a7..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>November 14, 2008</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/build.properties b/plugins/core/org.eclipse.papyrus.ui.resources/build.properties
deleted file mode 100644
index b677da13122..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-#Mon Sep 12 09:30:21 CEST 2011
-bin.includes=META-INF/,.,plugin.properties,plugin.xml,about.html,OSGI-INF/,OSGI-INF/l10n/,OSGI-INF/l10n/bundle.properties,src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties
-output..=bin/
-src.includes=about.html,META-INF/,.,plugin.properties,plugin.xml,OSGI-INF/,OSGI-INF/l10n/,OSGI-INF/l10n/bundle.properties,src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties
-source..=src/
-bin..=bin/
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/plugin.properties b/plugins/core/org.eclipse.papyrus.ui.resources/plugin.properties
deleted file mode 100644
index 2c2ed53f763..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-#################################################################################
-# Copyright (c) 2011 Atos Origin.
-# 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:
-# Arthur Daussy arthur.daussy@atosorigin.com - Initial API and implementation
-##################################################################################
-pluginName=Papyrus plugin for refactoring resources (Incubation)
-providerName=Eclipse Modeling Project \ No newline at end of file
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/plugin.xml b/plugins/core/org.eclipse.papyrus.ui.resources/plugin.xml
deleted file mode 100644
index f8a0401f551..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/plugin.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.ltk.core.refactoring.renameParticipants">
- <renameParticipant
- class="org.eclipse.papyrus.ui.resources.refactoring.RenameModelParticipant"
- id="org.eclipse.papyrus.ui.resources.renameParticipant"
- name="%renameParticipant.name">
- <enablement>
- <with
- variable="element">
- <instanceof
- value="org.eclipse.core.resources.IFile">
- </instanceof>
- </with>
- </enablement>
- </renameParticipant>
- </extension>
- <extension
- point="org.eclipse.ltk.core.refactoring.deleteParticipants">
- <deleteParticipant
- class="org.eclipse.papyrus.ui.resources.refactoring.DeleteModelParticipant"
- id="org.eclipse.papyrus.ui.resources.deleteParticipant"
- name="%deleteParticipant.name">
- <enablement>
- <with
- variable="element">
- <instanceof
- value="org.eclipse.core.resources.IFile">
- </instanceof>
- </with></enablement>
- </deleteParticipant>
- </extension>
- <extension
- point="org.eclipse.ltk.core.refactoring.moveParticipants">
- <moveParticipant
- class="org.eclipse.papyrus.ui.resources.refactoring.MoveModelParticipant"
- id="org.eclipse.papyrus.ui.resources.moveParticipant"
- name="%moveParticipant.name">
- <enablement>
- <instanceof
- value="org.eclipse.core.resources.IFile">
- </instanceof></enablement>
- </moveParticipant>
- </extension>
-
-</plugin>
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/Activator.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/Activator.java
deleted file mode 100644
index 705c2d89351..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/Activator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources;
-
-import org.eclipse.papyrus.log.LogHelper;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.ui.resources"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** The log service */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DeleteModelParticipant.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DeleteModelParticipant.java
deleted file mode 100644
index b06dffd851e..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DeleteModelParticipant.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.NullChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant;
-import org.eclipse.ltk.core.refactoring.resource.DeleteResourceChange;
-
-/**
- * The participant that is aware of file deletion.
- * FIXME Integrate and create register to the extension point
- *
- * @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
- *
- */
-public class DeleteModelParticipant extends DeleteParticipant {
-
- /** action name */
- private static final String NAME = "Papyrus Model Deletion";
-
- private Set<IResource> filesToRemove;
-
- /**
- * Overrides checkConditions.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
- return new RefactoringStatus();
- }
-
- /**
- * Overrides createChange.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- List<Change> changes = new ArrayList<Change>(filesToRemove.size());
- for(IResource file : filesToRemove) {
- if(file.exists()) {
- changes.add(new InternalDeleteResourceChange(file.getFullPath(), true));
- }
- }
- if(changes.isEmpty()) {
- return new NullChange();
- } else {
- return new CompositeChange(getName(), changes.toArray(new Change[changes.size()]));
- }
- }
-
- /**
- * Overrides getName.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
- */
- @Override
- public String getName() {
- return NAME;
- }
-
- /**
- * Overrides initialize.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#initialize(java.lang.Object)
- */
- @Override
- protected boolean initialize(Object element) {
- if(!(element instanceof IFile)) {
- return false;
- }
- IFile file = (IFile)element;
-
- filesToRemove = ModelParticipantHelpers.getRelatedFiles(file);
- return filesToRemove.size() > 0;
- }
-
-
-
- private class InternalDeleteResourceChange extends DeleteResourceChange {
-
- /**
- * Constructor.
- *
- * @param resourcePath
- * The file to delete.
- * @param forceOutOfSync
- * Delete even if out of sync
- */
- public InternalDeleteResourceChange(IPath resourcePath, boolean forceOutOfSync) {
- super(resourcePath, forceOutOfSync);
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.resource.DeleteResourceChange#perform(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param pm
- * @return
- * @throws CoreException
- */
-
- @Override
- public Change perform(IProgressMonitor pm) throws CoreException {
- IResource resource = getModifiedResource();
- // If the user selects the 3 resources, the delete fails.
- if(resource == null || !resource.exists()) {
- return new NullChange();
- }
- return super.perform(pm);
- }
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DirtyEditorChange.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DirtyEditorChange.java
deleted file mode 100644
index ecab933cb95..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/DirtyEditorChange.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * A change that checks if an editor is actually editing the model and if it must be save.
- *
- * @author tszadel
- *
- */
-public class DirtyEditorChange extends Change {
-
- private final IFile oldFile;
-
- private final IFile newFile;
-
- /**
- * Constructor.
- *
- * @param resourceSet
- * The resource set being changed.
- * @param oldFile
- * The old file.
- * @param newFile
- * The new file.
- */
- public DirtyEditorChange(IFile oldFile, IFile newFile) {
- this.oldFile = oldFile;
- this.newFile = newFile;
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.Change#getModifiedElement()
- *
- * @return
- */
-
- @Override
- public Object getModifiedElement() {
- return oldFile;
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.Change#getName()
- *
- * @return
- */
-
- @Override
- public String getName() {
- return Messages.DirtyEditorChange_0;
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.Change#initializeValidationData(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param pm
- */
-
- @Override
- public void initializeValidationData(IProgressMonitor pm) {
- // Nothing
- }
-
-
- private boolean hasDirtyEditors() {
- IMultiDiagramEditor[] list = EditorUtils.getRelatedEditors(oldFile);
- if(list != null && list.length > 0) {
- for(IMultiDiagramEditor editor : list) {
- if(editor.isDirty()) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.Change#isValid(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param pm
- * The progress monitor.
- * @return The status.
- * @throws CoreException
- * Error.
- * @throws OperationCanceledException
- * Operation canceled.
- */
-
- @Override
- public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- final RefactoringStatus status = new RefactoringStatus();
- // We need to get the current workbench... so we have to use the UI-Thread!
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- if(hasDirtyEditors()) {
- if(!MessageDialog.openConfirm(Display.getDefault().getActiveShell(), Messages.DirtyEditorChange_1, Messages.DirtyEditorChange_2)) {
- status.addFatalError(Messages.DirtyEditorChange_3);
- }
- }
- }
- });
-
- return status;
- }
-
- /**
- * @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param pm
- * The progress monitor.
- * @return The change used to undo.
- * @throws CoreException
- * Error.
- */
-
- @Override
- public Change perform(IProgressMonitor pm) throws CoreException {
- // Nothing to do
- return new DirtyEditorChange(newFile, oldFile);
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/Messages.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/Messages.java
deleted file mode 100644
index 82a9a40f31f..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/Messages.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos Origin.
- *
- *
- * 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:
- * Arthur Daussy - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.ui.resources.refactoring.messages"; //$NON-NLS-1$
-
- public static String DirtyEditorChange_0;
-
- public static String DirtyEditorChange_1;
-
- public static String DirtyEditorChange_2;
-
- public static String DirtyEditorChange_3;
-
- public static String MoveModelParticipant_Name;
-
- public static String RenameModelChange_0;
-
- public static String RenameModelChange_5;
-
- public static String RenameModelChange_6;
-
- public static String RenameModelChange_7;
-
- public static String RenameModelChange_8;
-
- public static String RenameModelChange_Change;
-
- public static String RenameModelChange_DaveDirtyEditor;
-
- public static String RenameModelChange_ErrorLoading;
-
- public static String RenameModelChange_LoadingEMF;
-
- public static String RenameModelChange_ModifyURI;
-
- public static String RenameModelChange_Name;
-
- public static String RenameModelChange_RemoveOldFile;
-
- public static String RenameModelChange_savingResource;
-
- public static String RenameModelChange_Unloading;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ModelParticipantHelpers.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ModelParticipantHelpers.java
deleted file mode 100644
index 3be266874d4..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ModelParticipantHelpers.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.papyrus.resource.sasheditor.DiModel;
-import org.eclipse.papyrus.ui.resources.refactoring.ui.RenameParticipantsDialog;
-import org.eclipse.swt.widgets.Display;
-
-public class ModelParticipantHelpers {
-
- /**
- * get the files related the initialFile which need to be modified/deleted
- * if initialFile is modified/deleted
- *
- * @param initialFile
- * @return a list of related files. Does not include initialFile.
- */
- public static Set<IResource> getResourceToFix(final IFile initialFile) {
-
- RenameDialogRunnable runnable = new RenameDialogRunnable(initialFile);
- Display.getDefault().syncExec(runnable);
- return new HashSet<IResource>(runnable.getFiles());
- }
-
- /**
- * get the files related the initialFile which need to be modified/deleted
- * if initialFile is modified/deleted
- *
- * @param initialFile
- * @return a list of related files. Does not include initialFile.
- */
- public static Set<IResource> getRelatedFiles(final IFile initialFile) {
-
-
- IContainer parent = initialFile.getParent();
- IPath initialPath = initialFile.getFullPath();
-
- IPath diPath = null;
-
- if(DiModel.DI_FILE_EXTENSION.equalsIgnoreCase(initialPath.getFileExtension())) {
- diPath = initialPath;
- } else {
- // try to find a di file with the same name
- try {
- for(IResource r : parent.members()) {
- IPath p = r.getFullPath();
- if(DiModel.DI_FILE_EXTENSION.equalsIgnoreCase(p.getFileExtension()) && p.removeFileExtension().equals(initialPath.removeFileExtension())) {
- diPath = p;
- break;
- }
- }
- } catch (CoreException e) {
- }
- }
-
- Set<IResource> relatedFiles = new HashSet<IResource>();
- if(diPath != null) {
- IFile diFile = parent.getFile(diPath.makeRelativeTo(parent.getFullPath()));
- if(diFile.exists()) {
- try {
- for(IResource r : diFile.getParent().members()) {
- if(r.getFullPath().removeFileExtension().lastSegment().equals(diFile.getFullPath().removeFileExtension().lastSegment())) {
- relatedFiles.add(r);
- }
- }
- } catch (CoreException e) {
- }
- }
- }
-
- // If the initialFile is contained in the list, we remove it
- if(relatedFiles.contains(initialFile)) {
- relatedFiles.remove(initialFile);
- }
-
-
-
- return relatedFiles;
- }
-
- private static List<IResource> getModelFilesFromNotationResource(Resource notationResource) {
- List<IResource> modelFiles = new ArrayList<IResource>();
-
- // look for a model associated with a diagram in notation
- for(EObject eObject : notationResource.getContents()) {
- if(eObject instanceof Diagram) {
- Diagram diagram = (Diagram)eObject;
- InternalEObject element = (InternalEObject)diagram.eGet(NotationPackage.Literals.VIEW__ELEMENT, false);
- if(element != null && element.eIsProxy()) {
- URI modelURI = element.eProxyURI().trimFragment();
- if(modelURI.isPlatform()) {
- IResource modelFile = ResourcesPlugin.getWorkspace().getRoot().findMember(modelURI.toPlatformString(true));
- if(modelFile != null) {
- modelFiles.add(modelFile);
- }
- }
- }
- }
- }
-
- return modelFiles;
- }
-
- public static class RenameDialogRunnable implements Runnable {
-
- private IFile initialFile;
-
- private RenameParticipantsDialog renameParticipantsDialog;
-
- public RenameDialogRunnable(IFile file) {
- initialFile = file;
- }
-
- public void run() {
- renameParticipantsDialog = new RenameParticipantsDialog(Display.getDefault().getActiveShell(), initialFile);
- renameParticipantsDialog.open();
- }
-
- public Collection<? extends IResource> getFiles() {
- return renameParticipantsDialog.getFiles();
- }
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/MoveModelParticipant.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/MoveModelParticipant.java
deleted file mode 100644
index 503f8fbef19..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/MoveModelParticipant.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- * <a href="mailto:arthur.daussy@atosorigin.com">Arthur Daussy</a> - Correction of the move ( set the destination attribute)
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.NullChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
-import org.eclipse.ltk.core.refactoring.resource.MoveResourceChange;
-
-/**
- * Participant that is aware of model deletion.
- * FIXME Integrate and create register to the extension point
- *
- * @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
- *
- */
-public class MoveModelParticipant extends MoveParticipant {
-
- private Set<IResource> filesToMove = new HashSet<IResource>();
-
- private IContainer destination;
-
- /**
- * Overrides checkConditions.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
- return new RefactoringStatus();
- }
-
- /**
- * Overrides createChange.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- List<Change> changes = new ArrayList<Change>(filesToMove.size());
-
- for(IResource path : filesToMove) {
- if(path.exists()) {
- changes.add(new MoveResourceChange(path, destination));
- }
- }
- if(changes.isEmpty()) {
- return new NullChange();
- } else {
- return new CompositeChange(getName(), changes.toArray(new Change[changes.size()]));
- }
- }
-
- /**
- * Overrides getName.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
- */
- @Override
- public String getName() {
- return Messages.MoveModelParticipant_Name;
- }
-
- /**
- * Overrides initialize.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#initialize(java.lang.Object)
- */
- @Override
- protected boolean initialize(Object element) {
- if(!(element instanceof IFile)) {
- return false;
- }
- IFile file = (IFile)element;
- Object _destination = getArguments().getDestination();
- if(_destination instanceof IContainer) {
- destination = (IContainer)_destination;
-
- }
- filesToMove = ModelParticipantHelpers.getRelatedFiles(file);
- return filesToMove.size() > 0;
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelChange.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelChange.java
deleted file mode 100644
index e51ac222ef8..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelChange.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import static org.eclipse.papyrus.ui.resources.Activator.log;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.resource.RenameResourceChange;
-import org.eclipse.papyrus.controlmode.mm.history.ControledResource;
-import org.eclipse.papyrus.controlmode.mm.history.historyPackage;
-import org.eclipse.papyrus.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.core.modelsetquery.impl.IModelSetQueryAdapter;
-import org.eclipse.papyrus.core.modelsetquery.impl.ModelSetQueryAdapter;
-import org.eclipse.papyrus.core.services.ServiceException;
-import org.eclipse.papyrus.core.utils.DiResourceSet;
-import org.eclipse.papyrus.core.utils.EditorUtils;
-import org.eclipse.papyrus.resource.ModelSet;
-import org.eclipse.papyrus.resource.ModelsReader;
-import org.eclipse.papyrus.resource.sasheditor.DiModelUtils;
-import org.eclipse.papyrus.ui.resources.Activator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * Rename the model.<BR>
- * <b>Note</b>: That change should be called inside a rename operation as it assumes that a {@link RenameResourceChange} occured.
- *
- * @author tszadel
- *
- */
-public class RenameModelChange extends Change {
-
- private final Map<URI, URI> uriMap = new HashMap<URI, URI>();
-
- private final IFile oldFile;
-
- private final IFile newFile;
-
- private final Set<IResource> relatedFiles;
-
- private final Collection<? extends IResource> impacted;
-
- private TransactionalEditingDomain domain;
-
- private ModelSet resourceSet;
-
- private List<IMultiDiagramEditor> openedEditors;
-
- private boolean isUndoOperation;
-
- /**
- * Constructor.
- *
- * @param resourceSet
- * The resource set being changed.
- * @param oldFile
- * The old file.
- * @param newFile
- * The new file.
- * @param impacted
- */
- public RenameModelChange(IFile oldFile, IFile newFile, Collection<? extends IResource> impacted) {
- this.oldFile = oldFile;
- this.newFile = newFile;
- this.impacted = impacted;
-
- IPath newPathWithoutExt = newFile.getFullPath().removeFileExtension();
-
- // Create the map of URI that are being modified in the resource set
- relatedFiles = ModelParticipantHelpers.getRelatedFiles(oldFile);
- relatedFiles.add(oldFile);
- for(IResource file : relatedFiles) {
- IPath path = file.getFullPath();
- URI oldURI = getPlatformURI(path);
- URI newURI = getPlatformURI(newPathWithoutExt.addFileExtension(path.getFileExtension()));
- uriMap.put(oldURI, newURI);
- }
- }
-
- /**
- * Overrides getModifiedElement.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.Change#getModifiedElement()
- */
- @Override
- public Object getModifiedElement() {
- return oldFile;
- }
-
- /**
- * Overrides getName.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.Change#getName()
- */
- @Override
- public String getName() {
- return Messages.bind(Messages.RenameModelChange_Name, oldFile.getName());
- }
-
- /**
- * Overrides initializeValidationData.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.Change#initializeValidationData(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void initializeValidationData(IProgressMonitor pm) {
- // Nothing
- }
-
- /**
- * Overrides isValid.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.Change#isValid(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- // That change assumes that the model resource has already been renamed
- // So, the first thing to do is to get the new file, to restore it in order
- // to change all the resources.
- pm.subTask(Messages.RenameModelChange_LoadingEMF);
-
- // String extension= newFile.getFileExtension();
- // if( extension == null){
- // newFile.getFullPath().addFileExtension(oldFile.getFileExtension());
- // }
- pm.subTask(Messages.RenameModelChange_DaveDirtyEditor);
- // We need to get the current workbench... so we have to use the UI-Thread!
- openedEditors = new ArrayList<IMultiDiagramEditor>();
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- IMultiDiagramEditor[] multiEditors = EditorUtils.getRelatedEditors(oldFile);
- if(multiEditors != null && multiEditors.length > 0) {
- for(IMultiDiagramEditor editor : multiEditors) {
- if(editor.isDirty()) {
- editor.doSave(new NullProgressMonitor());
- }
- openedEditors.add(editor);
- }
- }
- }
- });
- pm.worked(10);
-
- /*
- * Load ModelSet
- */
- resourceSet = new ModelSet();
- // XMIResourceFactoryImpl value = new XMIResourceFactoryImpl();
- // resourceSet.getResourceFactoryRegistry().getContentTypeToFactoryMap().put(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER, value);
- // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, value);
- try {
- ModelsReader reader = new ModelsReader();
- reader.readModel(resourceSet);
- resourceSet.loadModels(oldFile);
- for(IResource r : impacted) {
- if(r instanceof IFile) {
- IFile file = (IFile)r;
- try {
- resourceSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
- } catch (Exception e) {
- // to avoid load errors
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- // Force EMF resolve and load all the resources
- try {
- EcoreUtil.resolveAll(resourceSet);
- } catch (RuntimeException e) {
- // the resolve all does not have to break the operation
- }
- pm.worked(4);
- domain = resourceSet.getTransactionalEditingDomain();
- // TODO improve when impact analysis will be effective
- return manageResourceSet(pm, resourceSet);
- }
-
- /**
- * Get a platform resource URI of the given path
- *
- * @param path
- * the path
- * @return the uri
- */
- private URI getPlatformURI(IPath path) {
- return URI.createPlatformResourceURI(path.toString(), true);
- }
-
-
- /**
- * Overrides perform.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public Change perform(IProgressMonitor pm) throws CoreException {
- String lMsg = Messages.bind(Messages.RenameModelChange_Change, oldFile.getName(), newFile.getName());
- isUndoOperation = oldFile.exists() && !newFile.exists();
- if(!isUndoOperation) {
- newFile.move(oldFile.getFullPath(), true, new SubProgressMonitor(pm, 1));
- }
- pm.beginTask(lMsg, 30);
- try {
- doRun(pm, resourceSet, domain);
- // Now, save all the resources
- pm.subTask(Messages.RenameModelChange_savingResource);
- for(Resource res : resourceSet.getResources()) {
- if(res.getURI().isPlatformResource()) {
- try {
- res.save(null);
- } catch (Exception e) {
- log.error(Messages.bind(Messages.RenameModelChange_ErrorLoading, res.getURI()), e);
- }
- }
- }
- pm.worked(5);
-
- // Do not forget to unload all the resources to avoid memory leak
- pm.subTask(Messages.RenameModelChange_Unloading);
- resourceSet.unload();
- pm.worked(1);
-
- // Now, notify the editor of the change
- if(!openedEditors.isEmpty()) {
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
- // Get the DI file as the rename could occur on any model's file.
- IFile newDiFile = DiModelUtils.getRelatedDiFile(newFile);
- for(IMultiDiagramEditor editor : openedEditors) {
- try {
- DiResourceSet diRes = editor.getServicesRegistry().getService(DiResourceSet.class);
- if(diRes != null) {
- diRes.saveAs(newFile.getFullPath());
- }
- editor.setEditorInput(new FileEditorInput(newDiFile));
-
- } catch (ServiceException e) {
- log.error(e);
- } catch (IOException e) {
- log.error(e);
- }
- }
- }
- });
- }
-
- // Then, remove the old model files
- pm.subTask(Messages.RenameModelChange_RemoveOldFile);
- for(IResource file : relatedFiles) {
- if(file.exists()) {
- file.delete(true, new NullProgressMonitor());
- }
- }
- pm.worked(4);
-
- if(isUndoOperation) {
- newFile.move(oldFile.getFullPath(), true, new SubProgressMonitor(pm, 1));
- }
-
- return new RenameModelChange(newFile, oldFile, impacted);
- } finally {
- pm.done();
- }
- }
-
- private RefactoringStatus manageResourceSet(final IProgressMonitor pm, final ModelSet resourceSet) {
-
- final Collection<Resource> readOnlies = new HashSet<Resource>();
- // for each object of the resources renamed, the refactor will search if a resource is read only or not
- domain.getCommandStack().execute(new RecordingCommand(domain) {
-
- @Override
- protected void doExecute() {
- for(URI uri : uriMap.keySet()) {
- Resource r = resourceSet.getResource(uri, false);
- ECrossReferenceAdapter adapter = ECrossReferenceAdapter.getCrossReferenceAdapter(resourceSet);
- if(adapter != null) {
- adapter = new ECrossReferenceAdapter();
- adapter.setTarget(resourceSet);
- }
- if(r != null) {
- for(Iterator<EObject> i = EcoreUtil.getAllProperContents(r, false); i.hasNext();) {
- EObject e = i.next();
- Collection<Setting> references = adapter.getInverseReferences(e);
- for(Setting s : references) {
- EObject eObject = s.getEObject();
- if(eObject != null && eObject.eResource() != null && domain.isReadOnly(eObject.eResource())) {
- readOnlies.add(eObject.eResource());
- }
- }
- }
- }
- }
-
- }
- });
- // if read only => error to the user
- if(!readOnlies.isEmpty()) {
- StringBuffer buffer = new StringBuffer("The resources listed are read only, the rename process can not continue : ");
- int i = 0;
- for(Resource r : readOnlies) {
- if(i != 0) {
- buffer.append(", ");
- }
- buffer.append(r.getURI().toString());
- i++;
- }
- return RefactoringStatus.create(new Status(IStatus.ERROR, Activator.PLUGIN_ID, buffer.toString()));
- }
- return new RefactoringStatus();
-
- }
-
- private void doRun(final IProgressMonitor pm, final ModelSet resourceSet, final TransactionalEditingDomain domain) {
- domain.getCommandStack().execute(new RecordingCommand(domain) {
-
- @SuppressWarnings("restriction")
- @Override
- protected void doExecute() {
- // Manage Controlled map to ensure consistent history
- // TODO change this code when history will be useless
- URI modifiedURI = URI.createPlatformResourceURI(oldFile.getFullPath().removeFileExtension().toString(), true);
- IModelSetQueryAdapter controledResourcesAdapter = ModelSetQueryAdapter.getExistingTypeCacheAdapter(resourceSet);
- if(controledResourcesAdapter != null) {
- EObject first = null;
- for(Iterator<Notifier> i = resourceSet.getAllContents(); i.hasNext();) {
- Notifier n = i.next();
- if(n instanceof EObject) {
- first = (EObject)n;
- break;
- }
- }
- if(first != null) {
- Collection<EObject> resources = null;
- try {
- resources = controledResourcesAdapter.getReachableObjectsOfType(first, historyPackage.Literals.CONTROLED_RESOURCE);
- } catch (RuntimeException e) {
- // in case of errors integrity must be valid
- // even performances are bad
- resources = new LinkedList<EObject>();
- for(int i = 0; i < resourceSet.getResources().size(); i++) {
- Resource r = resourceSet.getResources().get(i);
- for(Iterator<EObject> it = r.getAllContents(); it.hasNext();) {
- EObject tmp = it.next();
- if(tmp instanceof ControledResource) {
- ControledResource controled = (ControledResource)tmp;
- resources.add(controled);
- }
- }
- }
- }
- for(EObject e : resources) {
- if(e instanceof ControledResource) {
- ControledResource controled = (ControledResource)e;
- URI baseURI = URI.createURI(e.eResource().getURI().trimSegments(1).trimFragment().toString() + "/");
- URI resolvedURI = URI.createURI(controled.getResourceURL()).resolve(baseURI);
- if(resolvedURI.trimFileExtension().equals(modifiedURI.trimFileExtension())) {
- String ext = resolvedURI.fileExtension();
- URI newURL = URI.createURI(resolvedURI.trimSegments(1).toString() + "/" + newFile.getFullPath().removeFileExtension().lastSegment().toString() + "." + ext);
- controled.setResourceURL(newURL.deresolve(baseURI).toString());
- }
- }
- }
- }
- }
- }
- });
- // Change the uri of the files
- pm.subTask(Messages.RenameModelChange_ModifyURI);
- for(Resource res : resourceSet.getResources()) {
- if(res.getURI().isPlatformResource()) {
- URI newURI = uriMap.get(res.getURI());
- if(newURI != null) {
- if(log.isDebugEnabled()) {
- log.debug(Messages.bind(Messages.RenameModelChange_6, Arrays.asList(res.getURI(), newURI)));
- }
- res.setURI(newURI);
- }
- }
-
- }
- pm.worked(5);
-
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelParticipant.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelParticipant.java
deleted file mode 100644
index 0df5f401156..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/RenameModelParticipant.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring;
-
-import java.util.Collection;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-
-/**
- * Participant that is aware of the renaming of a model.
- *
- * @author <a href="mailto:thomas.szadel@atosorigin.com">Thomas Szadel</a>
- *
- */
-public class RenameModelParticipant extends RenameParticipant {
-
- private IFile fileToRename;
-
- private IFile newFile;
-
- private Collection<? extends IResource> impacted;
-
- /**
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createPreChange(org.eclipse.core.runtime.IProgressMonitor)
- *
- * @param pm
- * The progress monitor.
- * @return The change.
- * @throws CoreException
- * @throws OperationCanceledException
- */
-
- @Override
- public Change createPreChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- return new DirtyEditorChange(fileToRename, newFile);
- }
-
- /**
- * Overrides checkConditions.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#checkConditions(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext)
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException {
- return new RefactoringStatus();
- }
-
- /**
- * Overrides createChange.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
- return new RenameModelChange(fileToRename, newFile, impacted);
- }
-
- /**
- * Overrides getName.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#getName()
- */
- @Override
- public String getName() {
- return "Papyrus Model Renaming";
- }
-
- /**
- * Overrides initialize.
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#initialize(java.lang.Object)
- */
- @Override
- protected boolean initialize(Object element) {
- if(!(element instanceof IFile)) {
- return false;
- }
- fileToRename = (IFile)element;
- String ext = fileToRename.getFileExtension();
-
- IContainer parent = fileToRename.getParent();
- String newName = getArguments().getNewName();
- int idx = newName.lastIndexOf('.');
- if(idx > 0) {
- newName = newName.substring(0, idx);
- } else {
- newName = newName + '.' + ext; // Always append the extension
- }
-
- boolean otherFiles = false;
- for(IResource file : ModelParticipantHelpers.getRelatedFiles(fileToRename)) {
- IPath path = file.getFullPath();
- // Only add the change if the resource exists
- IFile renFile = parent.getFile(path.makeRelativeTo(parent.getFullPath()));
- if(!path.equals(fileToRename.getFullPath()) && renFile.exists()) {
- otherFiles = true;
- break;
- }
- }
- if(otherFiles) {
- // Get the new file
- IPath newDiPath = fileToRename.getFullPath().removeLastSegments(1);
- newDiPath = newDiPath.append(newName).addFileExtension(ext);
- newFile = parent.getFile(newDiPath.makeRelativeTo(parent.getFullPath()));
- impacted = ModelParticipantHelpers.getResourceToFix(fileToRename);
- return true;
- } else {
- return false;
- }
-
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties
deleted file mode 100644
index 3b38d28d433..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/messages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-DirtyEditorChange_0=Check opened editors
-DirtyEditorChange_1=Confirm saving
-DirtyEditorChange_2=The related editor(s) must be saved to continue.
-DirtyEditorChange_3=Process can not continue if editors are not saved
-MoveModelParticipant_Name=Papyrus Model Move
-RenameModelChange_0=The resources listed are read only, the rename process can not continue :
-RenameModelChange_5=Warning
-RenameModelChange_6=Changing URI {0} into {1}
-RenameModelChange_7=The file you are renaming is opened in an editor and has unsaved changes.\nTo continue the process has to save the editor.\nDo you want to continue ?
-RenameModelChange_8=The process can not continue with an unsaved editor
-RenameModelChange_Change=Rename {0} to {1}
-RenameModelChange_DaveDirtyEditor=Saving dirty editors
-RenameModelChange_ErrorLoading=Error while loading resource {0}
-RenameModelChange_LoadingEMF=Loading EMF model into memory
-RenameModelChange_ModifyURI=Modifying resources' URI
-RenameModelChange_Name=Update all resources related to {0}
-RenameModelChange_RemoveOldFile=Removing old files
-RenameModelChange_savingResource=Saving resources
-RenameModelChange_Unloading=Unloading model
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/IScopeChooser.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/IScopeChooser.java
deleted file mode 100644
index db486f7bbba..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/IScopeChooser.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * <a href="mailto:tristan.faure@atos.net">Tristan FAURE</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring.ui;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-
-
-/**
- * Interface for elements getting related files from a file
- *
- * @author tfaure
- *
- */
-public interface IScopeChooser {
-
- /**
- * The name or label of the chooser
- *
- * @return
- */
- public String getName();
-
- /**
- * The description to inform user
- *
- * @return
- */
- public String getDescription();
-
- /**
- * Return the list of files related to the given parameter
- *
- * @param f
- * @return
- */
- public List<IFile> getRelatedFiles(IFile f);
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/Messages.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/Messages.java
deleted file mode 100644
index 63c55abcf6e..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/Messages.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.papyrus.ui.resources.refactoring.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.ui.resources.refactoring.ui.messages"; //$NON-NLS-1$
-
- public static String RenameParticipantsDialog_DESCRIPTION;
-
- public static String RenameParticipantsDialog_DESCRIPTION_LABEL;
-
- public static String RenameParticipantsDialog_DESCRIPTION_NO_ANALYSIS;
-
- public static String RenameParticipantsDialog_DESCRIPTION_PROJECT;
-
- public static String RenameParticipantsDialog_DESCRIPTION_WORKSPACE;
-
- public static String RenameParticipantsDialog_NAME_NO_ANALYSIS;
-
- public static String RenameParticipantsDialog_NAME_PROJECT;
-
- public static String RenameParticipantsDialog_NAME_WORKSPACE;
-
- public static String RenameParticipantsDialog_OPTIONS;
-
- public static String RenameParticipantsDialog_SELECT_RENAME_OPTION;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/RenameParticipantsDialog.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/RenameParticipantsDialog.java
deleted file mode 100644
index 3f16b7d3c6a..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/RenameParticipantsDialog.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * <a href="mailto:tristan.faure@atos.net">Tristan FAURE</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring.ui;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.ui.resources.refactoring.ui.ScopeChooser.ScopeChooserVisitor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.widgets.FormText;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-
-/**
- * Generated by Window Builder
- *
- * @author tfaure
- *
- */
-public class RenameParticipantsDialog extends TitleAreaDialog {
-
- private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
-
- private final IFile context;
-
- private FormText formDescription;
-
- protected IScopeChooser currentScope;
-
- /**
- * Create the dialog.
- *
- * @param parentShell
- */
- public RenameParticipantsDialog(Shell parentShell, IFile context) {
- super(parentShell);
- this.context = context;
- }
-
- /**
- * Create contents of the dialog.
- *
- * @param parent
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- setTitle(Messages.RenameParticipantsDialog_SELECT_RENAME_OPTION);
- Composite area = (Composite)super.createDialogArea(parent);
- Composite container = new Composite(area, SWT.NONE);
- container.setLayout(new GridLayout(1, false));
- container.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Section sctnOptions = formToolkit.createSection(container, Section.EXPANDED | Section.TITLE_BAR);
- sctnOptions.setDescription(""); //$NON-NLS-1$
- sctnOptions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- formToolkit.paintBordersFor(sctnOptions);
- sctnOptions.setText(Messages.RenameParticipantsDialog_OPTIONS);
-
- Composite composite = new Composite(sctnOptions, SWT.NONE);
- formToolkit.adapt(composite);
- formToolkit.paintBordersFor(composite);
- sctnOptions.setClient(composite);
- composite.setLayout(new GridLayout(1, false));
-
- FormText formText = formToolkit.createFormText(composite, false);
- formText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
- formToolkit.paintBordersFor(formText);
- formText.setText(Messages.RenameParticipantsDialog_DESCRIPTION, true, false);
-
- ComboViewer comboViewer = new ComboViewer(composite, SWT.READ_ONLY);
- comboViewer.setUseHashlookup(true);
- comboViewer.setLabelProvider(new ILabelProvider() {
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
-
- public void dispose() {
- }
-
- public void addListener(ILabelProviderListener listener) {
- }
-
- public String getText(Object element) {
- if(element instanceof IScopeChooser) {
- IScopeChooser scope = (IScopeChooser)element;
- return scope.getName();
- }
- return null;
- }
-
- public Image getImage(Object element) {
- return null;
- }
- });
- comboViewer.setContentProvider(new IStructuredContentProvider() {
-
- public Object[] getElements(Object inputElement) {
- return (Object[])inputElement;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
- });
-
- Combo combo = comboViewer.getCombo();
- combo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
- formToolkit.paintBordersFor(combo);
-
- Group grpDescription = new Group(composite, SWT.NONE);
- grpDescription.setLayout(new GridLayout(1, false));
- grpDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- grpDescription.setText(Messages.RenameParticipantsDialog_DESCRIPTION_LABEL);
- formToolkit.adapt(grpDescription);
- formToolkit.paintBordersFor(grpDescription);
-
- formDescription = formToolkit.createFormText(grpDescription, false);
- formDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
- formToolkit.paintBordersFor(formDescription);
- formDescription.setText("", false, false); //$NON-NLS-1$
-
- // when the selection changed the description too
- comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- if(event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selec = (IStructuredSelection)event.getSelection();
- if(selec.getFirstElement() instanceof IScopeChooser) {
- IScopeChooser chooser = (IScopeChooser)selec.getFirstElement();
- formDescription.setText(chooser.getDescription(), true, false);
- currentScope = chooser;
- }
- }
- }
- });
- Object[] input = getInput();
- comboViewer.setInput(input);
- comboViewer.setSelection(new StructuredSelection(input[0]));
- return area;
- }
-
- /**
- * Pre defined list of chooser maybe later an extension point will be creates
- *
- * @return
- */
- private Object[] getInput() {
- final ScopeChooserVisitor visitor = new ScopeChooserVisitor();
- return new IScopeChooser[]{ new ScopeChooser(Messages.RenameParticipantsDialog_NAME_PROJECT, Messages.RenameParticipantsDialog_DESCRIPTION_PROJECT) {
-
- public List<IFile> getRelatedFiles(IFile f) {
- try {
- f.getProject().accept(visitor, IResource.DEPTH_INFINITE, IContainer.EXCLUDE_DERIVED);
- return visitor.getFiles();
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return Collections.emptyList();
- }
- }, new ScopeChooser(Messages.RenameParticipantsDialog_NAME_WORKSPACE, Messages.RenameParticipantsDialog_DESCRIPTION_WORKSPACE) {
-
- public List<IFile> getRelatedFiles(IFile f) {
- try {
- ResourcesPlugin.getWorkspace().getRoot().accept(visitor, IResource.DEPTH_INFINITE, IContainer.EXCLUDE_DERIVED);
- return visitor.getFiles();
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return Collections.emptyList();
- }
- }, new ScopeChooser(Messages.RenameParticipantsDialog_NAME_NO_ANALYSIS, Messages.RenameParticipantsDialog_DESCRIPTION_NO_ANALYSIS) {
-
- public List<IFile> getRelatedFiles(IFile f) {
- return Arrays.asList(f);
- }
- } };
- }
-
- /**
- * Create contents of the button bar.
- *
- * @param parent
- */
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
-
- /**
- * Return the initial size of the dialog.
- */
- @Override
- protected Point getInitialSize() {
- return new Point(450, 300);
- }
-
- public Collection<? extends IResource> getFiles() {
- return currentScope.getRelatedFiles(context);
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/ScopeChooser.java b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/ScopeChooser.java
deleted file mode 100644
index a9004dd8e99..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/ScopeChooser.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 Atos.
- *
- *
- * 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:
- * <a href="mailto:tristan.faure@atos.net">Tristan FAURE</a> - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.ui.resources.refactoring.ui;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
-import org.eclipse.ui.ide.IDE;
-
-
-
-/**
- * Default Implementation of {@link IScopeChooser}
- *
- * @author tfaure
- */
-public abstract class ScopeChooser implements IScopeChooser {
-
- private final String description;
-
- private final String label;
-
- public ScopeChooser(String label, String formDescription) {
- this.label = label;
- this.description = formDescription;
-
- }
-
- public String getName() {
- return label;
- }
-
- public String getDescription() {
- return description;
- }
-
-
-
- public static class ScopeChooserVisitor implements IResourceVisitor {
-
- private List<IFile> files = new LinkedList<IFile>();
-
- public boolean visit(IResource resource) throws CoreException {
- if(resource instanceof IFile) {
- IFile file = (IFile)resource;
- if(isXMI(file)) {
- files.add(file);
- }
- return false;
- }
- return true;
- }
-
- /**
- * Determine if the given file is an XMI some specific code has been set for notation and di
- *
- * @param f
- * @return
- */
- public boolean isXMI(IFile f) {
- URI uri = URI.createPlatformResourceURI(f.getFullPath().toString(), true);
- IContentType contentType = IDE.getContentType(f);
- Registry instance = Resource.Factory.Registry.INSTANCE;
- Object old = instance.getContentTypeToFactoryMap().get(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER);
- Object old2 = instance.getExtensionToFactoryMap().get(Resource.Factory.Registry.DEFAULT_EXTENSION);
- instance.getContentTypeToFactoryMap().put(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER, null);
- instance.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, null);
- boolean result = (f != null && contentType != null && (Resource.Factory.Registry.INSTANCE.getFactory(uri, contentType.getId()) != null || "notation".equals(f.getFileExtension()) || "di".equals(f.getFileExtension())));
- instance.getContentTypeToFactoryMap().put(Resource.Factory.Registry.DEFAULT_CONTENT_TYPE_IDENTIFIER, old);
- instance.getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, old2);
- return result;
- }
-
- public List<IFile> getFiles() {
- return files;
- }
-
- }
-
-}
diff --git a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/messages.properties b/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/messages.properties
deleted file mode 100644
index eff43c17e63..00000000000
--- a/plugins/core/org.eclipse.papyrus.ui.resources/src/org/eclipse/papyrus/ui/resources/refactoring/ui/messages.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-RenameParticipantsDialog_DESCRIPTION=<form><p>The rename operation can have several impacts on related files</p><p>Please choose the scope of references fixing operation</p></form>
-RenameParticipantsDialog_DESCRIPTION_LABEL=Description
-RenameParticipantsDialog_DESCRIPTION_NO_ANALYSIS=<form><p>No analysis is performed, this option is recommended for experimented users</p></form>
-RenameParticipantsDialog_DESCRIPTION_PROJECT=<form><p>The references will be analysed in the project of the renamed file</p></form>
-RenameParticipantsDialog_DESCRIPTION_WORKSPACE=<form><p>The references will be analysed in the whole workspace</p><p>This operation can be long</p></form>
-RenameParticipantsDialog_NAME_NO_ANALYSIS=No Analysis
-RenameParticipantsDialog_NAME_PROJECT=Project (default)
-RenameParticipantsDialog_NAME_WORKSPACE=Workspace
-RenameParticipantsDialog_OPTIONS=Options
-RenameParticipantsDialog_SELECT_RENAME_OPTION=Select Rename Options

Back to the top