Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Roldan Betancort2010-03-16 12:44:53 +0000
committerVictor Roldan Betancort2010-03-16 12:44:53 +0000
commitb706f82b6d9d3d5045adc3a3824c509e02e87a70 (patch)
treee603b0f2952e86371dfaf67de66e75c7e665e208 /plugins/org.eclipse.emf.cdo.ui.ide/src
parent0bebbd3f90a3fa2d5e023a6b248111ad70a1619a (diff)
downloadcdo-b706f82b6d9d3d5045adc3a3824c509e02e87a70.tar.gz
cdo-b706f82b6d9d3d5045adc3a3824c509e02e87a70.tar.xz
cdo-b706f82b6d9d3d5045adc3a3824c509e02e87a70.zip
- Fixed several issues described in the UI document
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui.ide/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ChangeViewTargetActionDelegate.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RenameResourceNodeActionDelegate.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ViewAwareActionDelegate.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/messages/messages.properties1
4 files changed, 157 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ChangeViewTargetActionDelegate.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ChangeViewTargetActionDelegate.java
new file mode 100644
index 0000000000..acbed12fc0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ChangeViewTargetActionDelegate.java
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.ui.internal.ide.actions;
+
+import org.eclipse.emf.cdo.internal.ui.actions.ChangeViewTargetAction;
+
+import org.eclipse.jface.action.IAction;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class ChangeViewTargetActionDelegate extends ViewAwareActionDelegate
+{
+ private IAction action;
+
+ public ChangeViewTargetActionDelegate()
+ {
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ if (action == null)
+ {
+ action = new ChangeViewTargetAction(getPage(), getView());
+ }
+ action.run();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RenameResourceNodeActionDelegate.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RenameResourceNodeActionDelegate.java
new file mode 100644
index 0000000000..2931cadf46
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/RenameResourceNodeActionDelegate.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.ui.internal.ide.actions;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.internal.ui.actions.ResourceNodeNameInputValidator;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.internal.ide.messages.Messages;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.InputDialog;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class RenameResourceNodeActionDelegate extends TransactionalBackgroundActionDelegate
+{
+ private String newResourceName;
+
+ public RenameResourceNodeActionDelegate()
+ {
+ super(Messages.getString("RenameResourceNodeActionDelegate.0")); //$NON-NLS-1$
+ }
+
+ @Override
+ protected CDOObject preRun(CDOObject object)
+ {
+ InputDialog dialog = new InputDialog(getTargetPart().getSite().getShell(), getText(), Messages
+ .getString("NewResourceNodeAction_0"), null, new ResourceNodeNameInputValidator((CDOResourceNode)object)); //$NON-NLS-1$
+ if (dialog.open() == Dialog.OK)
+ {
+ setNewResourceName(dialog.getValue());
+ return super.preRun(object);
+ }
+
+ cancel();
+
+ return null;
+ }
+
+ private void setNewResourceName(String newName)
+ {
+ newResourceName = newName;
+ }
+
+ private String getNewResourceName()
+ {
+ return newResourceName;
+ }
+
+ @Override
+ protected final void doRun(CDOTransaction transaction, CDOObject object, IProgressMonitor progressMonitor)
+ throws Exception
+ {
+ if (object instanceof CDOResourceNode)
+ {
+ ((CDOResourceNode)object).setName(getNewResourceName());
+ }
+ else
+ {
+ throw new IllegalArgumentException("object is not a CDOResourceNode"); //$NON-NLS-1$
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ViewAwareActionDelegate.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ViewAwareActionDelegate.java
new file mode 100644
index 0000000000..37976a3cf9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/ViewAwareActionDelegate.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.ui.internal.ide.actions;
+
+import org.eclipse.emf.cdo.ui.ide.Node;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.actions.SafeActionDelegate;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public abstract class ViewAwareActionDelegate extends SafeActionDelegate
+{
+ public ViewAwareActionDelegate()
+ {
+ }
+
+ public CDOView getView()
+ {
+ Node node = UIUtil.getElement(getSelection(), Node.class);
+ return node.getRepositoryProject().getView();
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/messages/messages.properties b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/messages/messages.properties
index 8e4e252a97..e597aad568 100644
--- a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/messages/messages.properties
@@ -23,6 +23,7 @@ RemoveResourceAction_2=Are you sure you want to delete the selected {0} item(s)?
RemoveResourceAction_3=Deleting CDOResource(s)
RemoveResourceAction_4={0}: Cannot perform commit
RemoveResourceAction_5={0} element(s) removed
+RenameResourceNodeActionDelegate.0=Rename
TeamConfigurationWizard_1=Share Project to CDO
TeamConfigurationWizard_2=Enter CDO repository location information
TeamConfigurationWizard_3=Provide a URL to the target server and a repository name

Back to the top