Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java12
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/IReadOnlyHandler.java19
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java32
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTransactionalEditingDomainProvider.java)12
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java31
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyOneFileApprover.java)50
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java5
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteHandler.java3
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java16
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java8
-rw-r--r--plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java7
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF3
-rw-r--r--plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java23
14 files changed, 138 insertions, 87 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
index a5d8ad53e39..4f54e16f2bf 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
@@ -90,7 +90,7 @@
<extension
point="org.eclipse.papyrus.infra.core.transactionalEditingDomainProvider">
<transactionalEditingDomainProvider
- class="org.eclipse.papyrus.infra.emf.readonly.ReadOnlyTransactionalEditingDomainProvider"
+ class="org.eclipse.papyrus.infra.emf.readonly.PapyrusROTransactionalEditingDomainProvider"
priority="10">
</transactionalEditingDomainProvider>
</extension>
@@ -107,7 +107,7 @@
<extension
point="org.eclipse.papyrus.infra.gmfdiag.commands.operationApprover">
<operationApprover
- class="org.eclipse.papyrus.infra.emf.readonly.FSReadOnlyOneFileApprover"
+ class="org.eclipse.papyrus.infra.emf.readonly.ReadOnlyOneFileApprover"
priority="10">
</operationApprover>
</extension>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
index cb9fe8a781d..d44a15261de 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
@@ -18,12 +18,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
public class FSReadOnlyHandler implements IReadOnlyHandler {
- public boolean isReadOnly(IFile[] files) {
+ public boolean isReadOnly(IFile[] files, EditingDomain editingDomain) {
for(IFile file : files) {
if(file != null && file.isReadOnly()) {
return true;
@@ -32,15 +33,16 @@ public class FSReadOnlyHandler implements IReadOnlyHandler {
return false;
}
- // TODO ask user
- public boolean enableWrite(final IFile[] files) {
+ public boolean enableWrite(final IFile[] files, EditingDomain editingDomain) {
final AtomicBoolean doEnableWrite = new AtomicBoolean();
Display.getCurrent().syncExec(new Runnable() {
public void run() {
String message = "Do you want to remove read only flag on those files ?\n\n";
for(IFile file : files) {
- message += file.getName() + "\n";
+ if(file != null && file.isReadOnly()) {
+ message += file.getName() + "\n";
+ }
}
doEnableWrite.set(MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Enable write", message));
}
@@ -49,7 +51,7 @@ public class FSReadOnlyHandler implements IReadOnlyHandler {
if(doEnableWrite.get()) {
boolean ok = true;
for(IFile file : files) {
- if(file != null) {
+ if(file != null && file.isReadOnly()) {
try {
ResourceAttributes att = file.getResourceAttributes();
att.setReadOnly(false);
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/IReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/IReadOnlyHandler.java
index 4f55dc2a1ed..bbe6d16a869 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/IReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/IReadOnlyHandler.java
@@ -14,10 +14,25 @@
package org.eclipse.papyrus.infra.emf.readonly;
import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.edit.domain.EditingDomain;
public interface IReadOnlyHandler {
- boolean isReadOnly(IFile[] files);
+ /**
+ * Check if a set of files is read-only.
+ * A set of files is usually considered read-only if at least
+ * one of them is read only.
+ *
+ * @param files
+ * @return
+ */
+ boolean isReadOnly(IFile[] files, EditingDomain editingDomain);
- boolean enableWrite(IFile[] files);
+ /**
+ * Try to enable write access on a set of files.
+ *
+ * @param files
+ * @return false if it fails to get write access.
+ */
+ boolean enableWrite(IFile[] files, EditingDomain editingDomain);
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
new file mode 100644
index 00000000000..5848edf1f67
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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:
+ * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.readonly;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+
+
+public class PapyrusROTransactionalEditingDomain extends TransactionalEditingDomainImpl {
+ public PapyrusROTransactionalEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack, ResourceSet resourceSet) {
+ super(adapterFactory, stack, resourceSet);
+ }
+
+ @Override
+ public boolean isReadOnly(Resource resource) {
+ return ReadOnlyManager.isReadOnly(resource, this);
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTransactionalEditingDomainProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java
index dd3916a3965..19233543070 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTransactionalEditingDomainProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomainProvider.java
@@ -13,11 +13,9 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
import org.eclipse.emf.workspace.IResourceUndoContextPolicy;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
@@ -31,19 +29,13 @@ import org.eclipse.papyrus.infra.core.resource.ITransactionalEditingDomainProvid
* @author mvelten
*
*/
-public class ReadOnlyTransactionalEditingDomainProvider implements ITransactionalEditingDomainProvider {
+public class PapyrusROTransactionalEditingDomainProvider implements ITransactionalEditingDomainProvider {
public TransactionalEditingDomain createTransactionalEditingDomain(ResourceSet resourceSet) {
NotifyingWorkspaceCommandStack stack = new NotifyingWorkspaceCommandStack(CheckedOperationHistory.getInstance());
stack.setResourceUndoContextPolicy(IResourceUndoContextPolicy.DEFAULT);
- TransactionalEditingDomain result = new TransactionalEditingDomainImpl(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet) {
-
- @Override
- public boolean isReadOnly(Resource resource) {
- return ReadOnlyManager.isReadOnly(resource);
- }
- };
+ TransactionalEditingDomain result = new PapyrusROTransactionalEditingDomain(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, resourceSet);
WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(result);
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
index f92aa13791c..87b07010a9c 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
public class ReadOnlyManager {
@@ -46,7 +47,7 @@ public class ReadOnlyManager {
}
static {
- IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.infra.emf.readonly", "readOnlyHandler");
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.papyrus.readonly", "readOnlyHandler");
List<HandlerPriorityPair> handlerPriorityPairs = new LinkedList<HandlerPriorityPair>();
for(IConfigurationElement elem : configElements) {
@@ -71,37 +72,35 @@ public class ReadOnlyManager {
}
}
- public static boolean isReadOnly(Resource resource) {
+ public static boolean isReadOnly(Resource resource, EditingDomain editingDomain) {
+ IFile file = null;
if(resource != null && resource.getURI() != null) {
if (resource.getURI().isPlatform()) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(resource.getURI().toPlatformString(true)));
- if(isReadOnly(file)) {
- return true;
- }
- } else {
- return true;
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(resource.getURI().toPlatformString(true)));
}
}
- return false;
+
+ return isReadOnly(file, editingDomain);
}
- public static boolean isReadOnly(IFile file) {
- return isReadOnly(new IFile[]{ file });
+ public static boolean isReadOnly(IFile file, EditingDomain editingDomain) {
+ IFile[] files = file != null ? new IFile[]{ file } : new IFile[]{};
+ return isReadOnly(files, editingDomain);
}
- public static boolean isReadOnly(IFile[] files) {
+ public static boolean isReadOnly(IFile[] files, EditingDomain editingDomain) {
for(int i = 0; i < orderedHandlersArray.length; i++) {
- if(orderedHandlersArray[i].isReadOnly(files)) {
+ if(orderedHandlersArray[i].isReadOnly(files, editingDomain)) {
return true;
}
}
return false;
}
- public static boolean enableWrite(IFile[] files) {
+ public static boolean enableWrite(IFile[] files, EditingDomain editingDomain) {
for(int i = 0; i < orderedHandlersArray.length; i++) {
- if(orderedHandlersArray[i].isReadOnly(files)) {
- boolean ok = orderedHandlersArray[i].enableWrite(files);
+ if(orderedHandlersArray[i].isReadOnly(files, editingDomain)) {
+ boolean ok = orderedHandlersArray[i].enableWrite(files, editingDomain);
if(!ok) {
return false;
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyOneFileApprover.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java
index 3880c2dc5e6..f534f389050 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyOneFileApprover.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyOneFileApprover.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.infra.emf.readonly;
import java.io.File;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.operations.IOperationApprover2;
@@ -26,15 +27,17 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
import org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult;
import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
import org.eclipse.papyrus.infra.onefile.utils.OneFileUtils;
-public class FSReadOnlyOneFileApprover implements IOperationApprover2 {
+public class ReadOnlyOneFileApprover implements IOperationApprover2 {
public IStatus proceedRedoing(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
return proceedExecuting(operation, history, info);
@@ -45,13 +48,12 @@ public class FSReadOnlyOneFileApprover implements IOperationApprover2 {
}
public IStatus proceedExecuting(IUndoableOperation operation, IOperationHistory history, IAdaptable info) {
+ HashSet<IFile> filesToCheckForLock = new HashSet<IFile>();
if(operation instanceof ICommand) {
ICommand command = (ICommand)operation;
List<IFile> affectedFiles = command.getAffectedFiles();
- HashSet<IFile> filesToCheckForLock = new HashSet<IFile>();
-
for(IFile affectedFile : affectedFiles) {
if(affectedFile == null)
continue;
@@ -78,24 +80,36 @@ public class FSReadOnlyOneFileApprover implements IOperationApprover2 {
}
}
}
-
- for(IFile file : affectedFiles) {
- URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-
- }
- if(filesToCheckForLock.size() > 0) {
- IFile[] filesToCheckForLockArray = filesToCheckForLock.toArray(new IFile[filesToCheckForLock.size()]);
- if(ReadOnlyManager.isReadOnly(filesToCheckForLock.toArray(filesToCheckForLockArray))) {
- boolean ok = ReadOnlyManager.enableWrite(filesToCheckForLockArray);
- if(!ok) {
- return Status.CANCEL_STATUS;
- }
- }
+ }
+
+ EditingDomain editingDomain = getEditingDomain(operation);
+
+ IFile[] filesToCheckForLockArray = filesToCheckForLock.toArray(new IFile[filesToCheckForLock.size()]);
+ if(ReadOnlyManager.isReadOnly(filesToCheckForLock.toArray(filesToCheckForLockArray), editingDomain)) {
+ boolean ok = ReadOnlyManager.enableWrite(filesToCheckForLockArray, editingDomain);
+ if(!ok) {
+ return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
+
+ protected EditingDomain getEditingDomain(IUndoableOperation command) {
+ EditingDomain editingDomain = null;
+ if (command instanceof AbstractEMFOperation) {
+ editingDomain = ((AbstractEMFOperation)command).getEditingDomain();
+ }
+
+ if (editingDomain == null && command instanceof ICompositeCommand) {
+ Iterator it = ((ICompositeCommand)command).iterator();
+ while (editingDomain == null && it.hasNext()) {
+ IUndoableOperation c = (IUndoableOperation)it.next();
+ editingDomain = getEditingDomain(c);
+ }
+ }
+ return editingDomain;
+ }
/**
* Sets the command result of the specified command to a CommandResult
@@ -107,7 +121,7 @@ public class FSReadOnlyOneFileApprover implements IOperationApprover2 {
* IStatus of the CommandResult that will be set on the
* command
*/
- public static void setCommandResult(ICommand command, IStatus status) {
+ protected void setCommandResult(ICommand command, IStatus status) {
if(command instanceof ICommandWithSettableResult) {
((ICommandWithSettableResult)command).internalSetResult(new CommandResult(status));
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
index da4f6fae691..84131173509 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
@@ -18,6 +18,7 @@ import java.util.Iterator;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.utils.BusinessModelResolver;
@@ -35,7 +36,9 @@ public class ReadOnlyTester extends PropertyTester {
Object businessObject = BusinessModelResolver.getInstance().getBusinessModel(obj);
if(businessObject instanceof EObject) {
Resource resource = ((EObject)businessObject).eResource();
- return ReadOnlyManager.isReadOnly(resource);
+ if (resource != null && resource.getResourceSet() != null) {
+ return ReadOnlyManager.isReadOnly(resource, WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(resource.getResourceSet()));
+ }
}
}
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteHandler.java
index af2e51b7040..1d69c09f255 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteHandler.java
@@ -10,6 +10,7 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.utils.BusinessModelResolver;
@@ -31,7 +32,7 @@ public class EnableWriteHandler extends AbstractHandler {
IPapyrusFile papFile = PapyrusModelHelper.getPapyrusModelFactory().createIPapyrusFile(file);
IFile[] associatedFiles = OneFileUtils.getAssociatedFiles(papFile);
- ReadOnlyManager.enableWrite(associatedFiles);
+ ReadOnlyManager.enableWrite(associatedFiles, WorkspaceEditingDomainFactory.INSTANCE.getEditingDomain(rs));
for(IFile associatedFile : associatedFiles) {
URI associatedUri = URI.createPlatformResourceURI(associatedFile.getFullPath().toString(), true);
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java
index 646281bd0f1..bdbecf8d15e 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/NotificationBuilder.java
@@ -315,7 +315,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createAsyncPopup(String text) {
- return new NotificationBuilder().setAsynchronous(true).setBuilderClass(AsyncNotifierBuilder.class).setTemporary(true).setMessage(text);
+ return new NotificationBuilder().setAsynchronous(true).setTemporary(true).setMessage(text).setDelay(2000);
}
/**
@@ -328,7 +328,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createAsyncPopup(String title, String text) {
- return new NotificationBuilder().setAsynchronous(true).setBuilderClass(AsyncNotifierBuilder.class).setTemporary(true).setMessage(text).setTitle(title);
+ return new NotificationBuilder().setAsynchronous(true).setTemporary(true).setMessage(text).setTitle(title).setDelay(2000);
}
/**
@@ -339,7 +339,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createInfoPopup(String text) {
- return new NotificationBuilder().setAsynchronous(false).setBuilderClass(PopupBuilder.class).setTemporary(false).setMessage(text).setType(Type.INFO);
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.INFO);
}
/**
@@ -350,7 +350,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createWarningPopup(String text) {
- return new NotificationBuilder().setAsynchronous(false).setBuilderClass(PopupBuilder.class).setTemporary(false).setMessage(text).setType(Type.WARNING);
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.WARNING);
}
/**
@@ -361,7 +361,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createQuestionPopup(String text) {
- return new NotificationBuilder().setAsynchronous(false).setBuilderClass(PopupBuilder.class).setTemporary(false).setMessage(text).setType(Type.QUESTION);
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.QUESTION);
}
/**
@@ -372,7 +372,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createErrorPopup(String text) {
- return new NotificationBuilder().setAsynchronous(false).setBuilderClass(PopupBuilder.class).setTemporary(false).setMessage(text).setType(Type.ERROR);
+ return new NotificationBuilder().setAsynchronous(false).setTemporary(false).setMessage(text).setType(Type.ERROR);
}
/**
@@ -385,7 +385,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createYesNo(String message, final Runnable yes, final Runnable no) {
- return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(true).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
+ return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(false).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
public void run(IContext context) {
if(yes != null) {
@@ -454,7 +454,7 @@ public class NotificationBuilder {
* @return a notification builder
*/
public static NotificationBuilder createYesNo(String message, final NotificationRunnable yes, final NotificationRunnable no) {
- return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(true).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
+ return new NotificationBuilder().setType(Type.QUESTION).setAsynchronous(false).setTemporary(false).setMessage(message).addAction(new NotificationRunnable() {
public void run(IContext context) {
if(yes != null) {
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java
index 342119c84f1..87770f54de5 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/builders/PopupBuilder.java
@@ -18,6 +18,7 @@ import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.IconAndMess
import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.MessagePapyrusPopup;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.popups.PopupNotification;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
@@ -44,13 +45,14 @@ public class PopupBuilder implements IBuilder {
if(wrapper.getMessage() != null) {
message = wrapper.getMessage();
}
+ Shell activeShell = new Shell(Display.getDefault());
if(wrapper.getType() != null) {
- popup = new IconAndMessagePapyrusPopup(Display.getDefault().getActiveShell(), toolkit, message, wrapper.getType());
+ popup = new IconAndMessagePapyrusPopup(activeShell, toolkit, message, wrapper.getType());
} else if(wrapper.getImage() != null) {
- popup = new IconAndMessagePapyrusPopup(Display.getDefault().getActiveShell(), toolkit, message);
+ popup = new IconAndMessagePapyrusPopup(activeShell, toolkit, message);
((IconAndMessagePapyrusPopup)popup).setImage(wrapper.getImage());
} else {
- popup = new MessagePapyrusPopup(Display.getDefault().getActiveShell(), toolkit, message);
+ popup = new MessagePapyrusPopup(activeShell, toolkit, message);
}
popup.setTitle(title);
popup.setUseHtml(wrapper.isHtml());
diff --git a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java
index 24cdb50a1f2..ac9fb7c9c72 100644
--- a/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java
+++ b/plugins/infra/widget/org.eclipse.papyrus.infra.widgets.toolbox/src/org/eclipse/papyrus/infra/widgets/toolbox/notification/dialogs/PapyrusAsyncNotificationPopup.java
@@ -74,7 +74,12 @@ public class PapyrusAsyncNotificationPopup extends AbstractNotificationPopup {
@Override
public void linkActivated(HyperlinkEvent e) {
- run(r);
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ PapyrusAsyncNotificationPopup.this.run(r);
+ }
+ });
}
});
first = false;
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF b/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
index c0267068ea7..42ee7bf54d9 100644
--- a/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
+++ b/plugins/team/org.eclipse.papyrus.team.svn/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@ Require-Bundle: org.eclipse.papyrus.infra.onefile;bundle-version="0.9.0",
org.eclipse.emf.ecore,
org.eclipse.team.svn.core;resolution:=optional,
org.eclipse.papyrus.infra.emf.readonly;bundle-version="0.9.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.9.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.9.0",
+ org.eclipse.emf.edit
Export-Package: org.eclipse.papyrus.team.svn
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
index 2e3966745e1..ee73a06fedc 100644
--- a/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
+++ b/plugins/team/org.eclipse.papyrus.team.svn/src/org/eclipse/papyrus/team/svn/SVNLockHandler.java
@@ -9,7 +9,6 @@
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Made the dependency to SVN optional
*
*****************************************************************************/
package org.eclipse.papyrus.team.svn;
@@ -18,6 +17,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.team.FileModificationValidationContext;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.emf.readonly.IReadOnlyHandler;
import org.eclipse.team.svn.core.IStateFilter;
import org.eclipse.team.svn.core.svnstorage.SVNRemoteStorage;
@@ -26,21 +26,9 @@ import org.eclipse.team.svn.ui.SVNTeamModificationValidator;
public class SVNLockHandler implements IReadOnlyHandler {
- SVNTeamModificationValidator validator;
+ SVNTeamModificationValidator validator = new SVNTeamModificationValidator();
- public SVNLockHandler() {
- try {
- validator = new SVNTeamModificationValidator();
- } catch (NoClassDefFoundError ex) {
- //If SVN is not installed, then the file is not locked, and can be written.
- }
-
- }
-
- public boolean isReadOnly(IFile[] files) {
- if(validator == null) {
- return false; //SVN is not installed
- }
+ public boolean isReadOnly(IFile[] files, EditingDomain editingDomain) {
IResource[] needsLockResources = FileUtility.filterResources(files, IStateFilter.SF_NEEDS_LOCK, IResource.DEPTH_ZERO);
for(IResource needsLockResource : needsLockResources) {
@@ -52,10 +40,7 @@ public class SVNLockHandler implements IReadOnlyHandler {
return false;
}
- public boolean enableWrite(IFile[] files) {
- if(validator == null) {
- return true; //SVN is not installed
- }
+ public boolean enableWrite(IFile[] files, EditingDomain editingDomain) {
IStatus result = validator.validateEdit(files, FileModificationValidationContext.VALIDATE_PROMPT);

Back to the top