From 1460904fd3c193ffaf809913b2983a400fce9d94 Mon Sep 17 00:00:00 2001
From: Eike Stepper
Date: Thu, 19 Jul 2012 10:22:04 +0200
Subject: Fix line endings in master (dos2unix)
---
.../.settings/org.eclipse.core.resources.prefs | 6 +-
plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml | 44 +-
plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt | 14 +-
.../org.eclipse.emf.cdo.dawn.ui/plugin.properties | 22 +-
plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml | 250 +++----
.../emf/cdo/dawn/internal/ui/bundle/OM.java | 90 +--
.../emf/cdo/dawn/ui/DawnColorConstants.java | 66 +-
.../eclipse/emf/cdo/dawn/ui/DawnEditorInput.java | 110 +--
.../eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java | 196 ++---
...lectionViewerAdapterFactoryContentProvider.java | 78 +-
.../eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java | 42 +-
.../CDOResourceNodeChooserComposite.java | 832 ++++++++++-----------
.../composites/CDOResourceNodeSelectionWidget.java | 294 ++++----
.../cdo/dawn/ui/handlers/LockObjectsHandler.java | 62 +-
.../emf/cdo/dawn/ui/handlers/SelectionHandler.java | 90 +--
.../cdo/dawn/ui/handlers/SolveConflictHandler.java | 120 +--
.../cdo/dawn/ui/handlers/UnLockObjectsHandler.java | 62 +-
.../dawn/ui/helper/EditorDescriptionHelper.java | 192 ++---
.../emf/cdo/dawn/ui/icons/DawnIconRegistry.java | 206 ++---
.../eclipse/emf/cdo/dawn/ui/messages/Messages.java | 98 +--
.../emf/cdo/dawn/ui/messages/messages.properties | 36 +-
.../ui/stylizer/DawnDefaultElementStylizer.java | 168 ++---
.../ui/stylizer/DawnElementStylizerRegistry.java | 324 ++++----
.../emf/cdo/dawn/ui/views/DawnItemProvider.java | 152 ++--
.../dawn/ui/views/DawnWizardPageItemProvider.java | 172 ++---
.../DawnCreateNewDiagramResourceWizardPage.java | 80 +-
.../wizards/DawnCreateNewResourceWizardPage.java | 370 ++++-----
.../dialogs/CDOResourceNodeSelectionDialog.java | 188 ++---
28 files changed, 2182 insertions(+), 2182 deletions(-)
(limited to 'plugins/org.eclipse.emf.cdo.dawn.ui')
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.core.resources.prefs
index 196cfa85d5..aa2771cd19 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 04 13:05:14 CEST 2011
-eclipse.preferences.version=1
-encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
+#Mon Jul 04 13:05:14 CEST 2011
+eclipse.preferences.version=1
+encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml b/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml
index 73d56a9429..85dd321200 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml
@@ -1,22 +1,22 @@
-
-
-
- This is the context help for the sample view with a tree viewer. It was generated by a PDE template.
-
-
-
-
-
-
-
-
-
+
+
+
+ This is the context help for the sample view with a tree viewer. It was generated by a PDE template.
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt
index 9cbb3ba084..cea141de92 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt
@@ -1,8 +1,8 @@
-Copyright (c) 2004 - 2012 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:
+Copyright (c) 2004 - 2012 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:
Martin Fluegge - initial API and implementation
\ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties
index acd46c75ba..f0a0e8c0a0 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties
@@ -1,11 +1,11 @@
-# Copyright (c) 2004 - 2012 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:
-# Martin Fluegge - initial API and implementation
-
-pluginName = CDO Dawn UI
-providerName = Eclipse Modeling Project
+# Copyright (c) 2004 - 2012 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:
+# Martin Fluegge - initial API and implementation
+
+pluginName = CDO Dawn UI
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml
index 058568fb25..ad3c42151f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml
@@ -1,125 +1,125 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java
index 5d5215c458..3a47a37930 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.internal.ui.bundle;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.OSGiActivator;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-
-/**
- * @author Martin Fluegge
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.ui"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Martin Fluegge
- * @since 1.0
- */
- public static final class Activator extends OSGiActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.internal.ui.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.ui"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java
index d8a82e937e..35cbb7c03b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java
@@ -1,33 +1,33 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public class DawnColorConstants
-{
- public static final Color COLOR_NO_BORDER = new Color(null, 255, 255, 255);
-
- public static final Color COLOR_LOCKED_REMOTELY = ColorConstants.yellow;
-
- public static final Color COLOR_LOCKED_LOCALLY = ColorConstants.green;
-
- public static final Color COLOR_DELETE_CONFLICT = new Color(null, 255, 0, 0);
-
- public static final Color COLOR_CHANGE_CONFLICT = new Color(null, 0, 0, 255);
-
- public static final Color COLOR_NO_CONFLICT = new Color(null, 255, 255, 255);
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnColorConstants
+{
+ public static final Color COLOR_NO_BORDER = new Color(null, 255, 255, 255);
+
+ public static final Color COLOR_LOCKED_REMOTELY = ColorConstants.yellow;
+
+ public static final Color COLOR_LOCKED_LOCALLY = ColorConstants.green;
+
+ public static final Color COLOR_DELETE_CONFLICT = new Color(null, 255, 0, 0);
+
+ public static final Color COLOR_CHANGE_CONFLICT = new Color(null, 0, 0, 255);
+
+ public static final Color COLOR_NO_CONFLICT = new Color(null, 255, 255, 255);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java
index 91f9780794..f9cc8d8deb 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java
@@ -1,55 +1,55 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.URI;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnEditorInput extends URIEditorInput implements IDawnEditorInput
-{
- private CDOResource resource = null;
-
- public DawnEditorInput(URI uri)
- {
- super(uri);
- }
-
- public CDOView getView()
- {
- return getResource().cdoView();
- }
-
- public boolean isViewOwned()
- {
- return false;
- }
-
- public String getResourcePath()
- {
- return getResource().getPath();
- }
-
- public void setResource(CDOResource resource)
- {
- this.resource = resource;
- }
-
- public CDOResource getResource()
- {
- return resource;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEditorInput extends URIEditorInput implements IDawnEditorInput
+{
+ private CDOResource resource = null;
+
+ public DawnEditorInput(URI uri)
+ {
+ super(uri);
+ }
+
+ public CDOView getView()
+ {
+ return getResource().cdoView();
+ }
+
+ public boolean isViewOwned()
+ {
+ return false;
+ }
+
+ public String getResourcePath()
+ {
+ return getResource().getPath();
+ }
+
+ public void setResource(CDOResource resource)
+ {
+ this.resource = resource;
+ }
+
+ public CDOResource getResource()
+ {
+ return resource;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
index caea4198b3..5dd6889bda 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
@@ -1,98 +1,98 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
-import org.eclipse.emf.cdo.dawn.spi.DawnState;
-import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
-import org.eclipse.emf.cdo.ui.CDOLabelProvider;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Martin Fluegge
- * @since 1.0
- */
-public class DawnLabelProvider extends CDOLabelProvider
-{
- public DawnLabelProvider(AdapterFactory adapterFactory, CDOView view, TreeViewer viewer)
- {
- super(adapterFactory, view, viewer);
- }
-
- @Override
- public Color getForeground(Object object)
- {
- // makes sure that the object is adapted
- Color foreground = super.getForeground(object);
-
- DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
-
- CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
- if (cdoObject.cdoWriteLock().isLocked())
- {
- return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
- }
- else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
- {
- return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
- }
- // Use default
- return foreground;
- }
-
- @Override
- public Color getBackground(Object object)
- {
- // makes sure that the object is adapted
- Color background = super.getBackground(object);
-
- DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
-
- CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
- if (cdoObject.cdoWriteLock().isLocked())
- {
- return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
- }
- else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
- {
- return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
- }
- // Use default
- return background;
- }
-
- @Override
- public Image getImage(Object object)
- {
- DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
-
- CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
- if (cdoObject.cdoWriteLock().isLocked())
- {
- return stylizer.getImage(cdoObject, DawnState.LOCKED_LOCALLY);
- }
- else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
- {
- return stylizer.getImage(cdoObject, DawnState.LOCKED_REMOTELY);
- }
-
- return super.getImage(object);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
+import org.eclipse.emf.cdo.ui.CDOLabelProvider;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class DawnLabelProvider extends CDOLabelProvider
+{
+ public DawnLabelProvider(AdapterFactory adapterFactory, CDOView view, TreeViewer viewer)
+ {
+ super(adapterFactory, view, viewer);
+ }
+
+ @Override
+ public Color getForeground(Object object)
+ {
+ // makes sure that the object is adapted
+ Color foreground = super.getForeground(object);
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+ // Use default
+ return foreground;
+ }
+
+ @Override
+ public Color getBackground(Object object)
+ {
+ // makes sure that the object is adapted
+ Color background = super.getBackground(object);
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+ // Use default
+ return background;
+ }
+
+ @Override
+ public Image getImage(Object object)
+ {
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+
+ return super.getImage(object);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java
index 0e7293e5fe..ba420fad87 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-
-/**
- * @author Martin Fluegge
- * @since 1.0
- */
-public class DawnSelectionViewerAdapterFactoryContentProvider extends AdapterFactoryContentProvider
-{
- private final CDOResource cdoResource;
-
- public DawnSelectionViewerAdapterFactoryContentProvider(AdapterFactory adapterFactory, CDOResource cdoResource)
- {
- super(adapterFactory);
- this.cdoResource = cdoResource;
- }
-
- @Override
- public Object[] getElements(Object object)
- {
- Object[] ret = new Object[1];
- ret[0] = cdoResource;
- return ret;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class DawnSelectionViewerAdapterFactoryContentProvider extends AdapterFactoryContentProvider
+{
+ private final CDOResource cdoResource;
+
+ public DawnSelectionViewerAdapterFactoryContentProvider(AdapterFactory adapterFactory, CDOResource cdoResource)
+ {
+ super(adapterFactory);
+ this.cdoResource = cdoResource;
+ }
+
+ @Override
+ public Object[] getElements(Object object)
+ {
+ Object[] ret = new Object[1];
+ ret[0] = cdoResource;
+ return ret;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java
index bc1a7f34e6..99d031e179 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java
@@ -1,21 +1,21 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui;
-
-import org.eclipse.emf.cdo.ui.CDOEditorInput;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public interface IDawnEditorInput extends CDOEditorInput
-{
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui;
+
+import org.eclipse.emf.cdo.ui.CDOEditorInput;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public interface IDawnEditorInput extends CDOEditorInput
+{
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java
index 6cb176bff0..71c42dbadc 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java
@@ -1,416 +1,416 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui.composites;
-
-import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
-import org.eclipse.emf.cdo.dawn.ui.messages.Messages;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.util.URI;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-import java.util.Date;
-
-/**
- * @author Martin Fluegge
- * @since 1.0
- */
-public class CDOResourceNodeChooserComposite extends Composite
-{
- private final String fileExtension;
-
- protected Text resourcePathComposite;
-
- protected Text resourceNameComposite;
-
- private String resourceNamePrefix = "default"; //$NON-NLS-1$
-
- protected CDOResourceNodeSelectionWidget selectCDOResourceNodeComposite;
-
- private final CDOView view;
-
- private ResourceChooserValidator validator;
-
- public CDOResourceNodeChooserComposite(Composite parent, int style, String fileExtension, CDOView view)
- {
- super(parent, style);
- this.fileExtension = fileExtension;
- this.view = view;
- init();
- setValidator(new ResourceChooserValidator());
- }
-
- private void createLayout()
- {
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 0;
- setLayout(layout);
- }
-
- public void setResourcePath(String resourcePath)
- {
- resourcePathComposite.setText(resourcePath);
- }
-
- public void setResourceName(String resourceNamePrefix)
- {
- resourceNameComposite.setText(resourceNamePrefix);
- }
-
- protected void init()
- {
- createLayout();
- createResourcePathInput();
-
- createResourceSelectionComposite();
-
- createResourceInput();
- }
-
- public String getResourceName()
- {
- return resourceNameComposite.getText();
- }
-
- public String getResourcePath()
- {
- return resourcePathComposite.getText();
- }
-
- private void createResourceSelectionComposite()
- {
- selectCDOResourceNodeComposite = new CDOResourceNodeSelectionWidget(this, SWT.NONE);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
-
- selectCDOResourceNodeComposite.setLayoutData(gd);
-
- selectCDOResourceNodeComposite.addSelectionChangedListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (event.getSelection().isEmpty())
- {
- resourceNameComposite.setText(""); //$NON-NLS-1$
- return;
- }
-
- if (event.getSelection() instanceof IStructuredSelection)
- {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- Object element = selection.getFirstElement();
- if (element instanceof CDOResource)
- {
- String resourceName = ((CDOResource)element).getName();
- resourcePathComposite.setText(((CDOResource)element).getPath().replace(resourceName, "")); //$NON-NLS-1$
- resourceNameComposite.setText(resourceName);
- }
- else if (element instanceof CDOResourceNode)
- {
- resourcePathComposite.setText(((CDOResourceNode)element).getPath());
- }
- }
-
- getValidator().validate();
- }
- });
- }
-
- private void createResourceInput()
- {
- Composite nameGroup = new Composite(this, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- Label label1 = new Label(nameGroup, SWT.NONE);
- label1.setText(Messages.DawnCreateNewResourceWizardPage_6);
-
- resourceNameComposite = new Text(nameGroup, SWT.BORDER | SWT.SINGLE);
- resourceNameComposite.setText(getDefaultName() + "." + fileExtension); //$NON-NLS-1$
- resourceNameComposite.addKeyListener(new KeyListener()
- {
- public void keyPressed(KeyEvent e)
- {
- }
-
- public void keyReleased(KeyEvent e)
- {
- getValidator().validate();
- }
- });
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- resourceNameComposite.setLayoutData(gd);
- }
-
- private GridData createResourcePathInput()
- {
- Label resourcePathLabel = new Label(this, SWT.NULL);
- resourcePathLabel.setText(Messages.DawnCreateNewResourceWizardPage_8);
-
- resourcePathComposite = new Text(this, SWT.BORDER | SWT.SINGLE);
- resourcePathComposite.setText(""); //$NON-NLS-1$
- resourcePathComposite.addKeyListener(new KeyListener()
- {
- public void keyPressed(KeyEvent e)
- {
- }
-
- public void keyReleased(KeyEvent e)
- {
- getValidator().validate();
- }
-
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- resourcePathComposite.setLayoutData(gd);
- return gd;
- }
-
- public void createAutomaticResourceName()
- {
- int i = 2;
- while (i < 30 && view.hasResource(getURI().path()))
- {
- resourceNameComposite.setText(getResourceNamePrefix() + i + "." + fileExtension); //$NON-NLS-1$
- i++;
- }
-
- if (i < 30)
- {
- return;
- }
- // if we have tried 30 times to find a new resource name and still not succeeded just add a timestamp to the name
- resourceNameComposite.setText(getResourceNamePrefix() + new Date().getTime() + "." + fileExtension); //$NON-NLS-1$
- }
-
- public URI getURI()
- {
- String resourcePath = getResourcePath();
- if (resourcePath.length() > 0)
- {
- if (resourcePath.startsWith("/")) //$NON-NLS-1$
- {
- resourcePath = resourcePath.substring(1, resourcePath.length());
- }
- if (!resourcePath.endsWith("/")) //$NON-NLS-1$
- {
- resourcePath = resourcePath + "/"; //$NON-NLS-1$
- }
- }
-
- String resourceName = getResourceName();
- String authority = PreferenceConstants.getRepositoryName();
- URI uri = URI.createURI("cdo://" + authority + "/" + resourcePath + resourceName); //$NON-NLS-1$ //$NON-NLS-2$
-
- return uri;
- }
-
- public String getDefaultName()
- {
- return getResourceNamePrefix();
- }
-
- public void showResources(boolean showResources)
- {
- selectCDOResourceNodeComposite.setShowResources(showResources);
- }
-
- public void setResourceNamePrefix(String resourceNamePrefix)
- {
- this.resourceNamePrefix = resourceNamePrefix;
- }
-
- public String getResourceNamePrefix()
- {
- return resourceNamePrefix;
- }
-
- public void setValidator(ResourceChooserValidator validator)
- {
- this.validator = validator;
- }
-
- public ResourceChooserValidator getValidator()
- {
- return validator;
- }
-
- /**
- * @author Martin Fluegge
- */
- public class ResourceChooserValidator
- {
- public static final int VALIDATION_NONE = 0;
-
- public static final int VALIDATION_WARN = 1;
-
- public static final int VALIDATION_ERROR = 2;
-
- private int resourceValidationType = VALIDATION_ERROR;
-
- private boolean valid;
-
- private int messageType = IMessageProvider.NONE;
-
- private String message;
-
- private ValidationListener validationListener;
-
- public ResourceChooserValidator()
- {
- }
-
- public void validate()
- {
- internalValidate();
- if (validationListener != null)
- {
- validationListener.validationFinished();
- }
- }
-
- private void internalValidate()
- {
- setValid(true);
-
- if (getResourceName().length() == 0)
- {
- setMessage(Messages.DawnCreateNewResourceWizardPage_10, IMessageProvider.ERROR);
- setValid(false);
- return;
- }
-
- if (!getResourceName().endsWith("." + fileExtension))
- {
- setValid(false);
- setMessage(Messages.CDOResourceNodeChooserComposite_1 + fileExtension, IMessageProvider.ERROR);
- return;
- }
-
- if (view != null && getResourceValidationType() != VALIDATION_NONE)
- {
- try
- {
- if (view.hasResource(getURI().path()))
- {
- if (getResourceValidationType() == VALIDATION_WARN)
- {
- setMessage(Messages.DawnCreateNewResourceWizardPage_11, IMessageProvider.WARNING);
- setMessageType(IMessageProvider.WARNING);
- setValid(true);
- return;
- }
- else if (getResourceValidationType() == VALIDATION_ERROR)
- {
- setMessage(Messages.DawnCreateNewResourceWizardPage_12, IMessageProvider.ERROR);
- setValid(false);
- setMessageType(IMessageProvider.ERROR);
- return;
- }
- }
- }
- catch (Exception e)
- {
- setMessage(e.getMessage());
- setMessageType(IMessageProvider.ERROR);
- }
- }
- if (isValid())
- {
- setMessage(null);
- setMessageType(IMessageProvider.NONE);
- }
- }
-
- private void setMessage(String message, int type)
- {
- setMessage(message);
- setMessageType(type);
- }
-
- public void setValid(boolean valid)
- {
- this.valid = valid;
- }
-
- public boolean isValid()
- {
- return valid;
- }
-
- public void setMessage(String message)
- {
- this.message = message;
- }
-
- public String getMessage()
- {
- return message;
- }
-
- public void setMessageType(int messageType)
- {
- this.messageType = messageType;
- }
-
- public int getMessageType()
- {
- return messageType;
- }
-
- public void setResourceValidationType(int resourceValidationType)
- {
- this.resourceValidationType = resourceValidationType;
- }
-
- public int getResourceValidationType()
- {
- return resourceValidationType;
- }
-
- public void setValidationListener(ValidationListener validationListener)
- {
- this.validationListener = validationListener;
- }
-
- public ValidationListener getValidationListener()
- {
- return validationListener;
- }
- }
-
- /**
- * @author Martin Fluegge
- */
- public static interface ValidationListener
- {
- public void validationFinished();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.composites;
+
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
+import org.eclipse.emf.cdo.dawn.ui.messages.Messages;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import java.util.Date;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class CDOResourceNodeChooserComposite extends Composite
+{
+ private final String fileExtension;
+
+ protected Text resourcePathComposite;
+
+ protected Text resourceNameComposite;
+
+ private String resourceNamePrefix = "default"; //$NON-NLS-1$
+
+ protected CDOResourceNodeSelectionWidget selectCDOResourceNodeComposite;
+
+ private final CDOView view;
+
+ private ResourceChooserValidator validator;
+
+ public CDOResourceNodeChooserComposite(Composite parent, int style, String fileExtension, CDOView view)
+ {
+ super(parent, style);
+ this.fileExtension = fileExtension;
+ this.view = view;
+ init();
+ setValidator(new ResourceChooserValidator());
+ }
+
+ private void createLayout()
+ {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ setLayout(layout);
+ }
+
+ public void setResourcePath(String resourcePath)
+ {
+ resourcePathComposite.setText(resourcePath);
+ }
+
+ public void setResourceName(String resourceNamePrefix)
+ {
+ resourceNameComposite.setText(resourceNamePrefix);
+ }
+
+ protected void init()
+ {
+ createLayout();
+ createResourcePathInput();
+
+ createResourceSelectionComposite();
+
+ createResourceInput();
+ }
+
+ public String getResourceName()
+ {
+ return resourceNameComposite.getText();
+ }
+
+ public String getResourcePath()
+ {
+ return resourcePathComposite.getText();
+ }
+
+ private void createResourceSelectionComposite()
+ {
+ selectCDOResourceNodeComposite = new CDOResourceNodeSelectionWidget(this, SWT.NONE);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ selectCDOResourceNodeComposite.setLayoutData(gd);
+
+ selectCDOResourceNodeComposite.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ if (event.getSelection().isEmpty())
+ {
+ resourceNameComposite.setText(""); //$NON-NLS-1$
+ return;
+ }
+
+ if (event.getSelection() instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof CDOResource)
+ {
+ String resourceName = ((CDOResource)element).getName();
+ resourcePathComposite.setText(((CDOResource)element).getPath().replace(resourceName, "")); //$NON-NLS-1$
+ resourceNameComposite.setText(resourceName);
+ }
+ else if (element instanceof CDOResourceNode)
+ {
+ resourcePathComposite.setText(((CDOResourceNode)element).getPath());
+ }
+ }
+
+ getValidator().validate();
+ }
+ });
+ }
+
+ private void createResourceInput()
+ {
+ Composite nameGroup = new Composite(this, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ nameGroup.setLayout(layout);
+ nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+ Label label1 = new Label(nameGroup, SWT.NONE);
+ label1.setText(Messages.DawnCreateNewResourceWizardPage_6);
+
+ resourceNameComposite = new Text(nameGroup, SWT.BORDER | SWT.SINGLE);
+ resourceNameComposite.setText(getDefaultName() + "." + fileExtension); //$NON-NLS-1$
+ resourceNameComposite.addKeyListener(new KeyListener()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ getValidator().validate();
+ }
+ });
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ resourceNameComposite.setLayoutData(gd);
+ }
+
+ private GridData createResourcePathInput()
+ {
+ Label resourcePathLabel = new Label(this, SWT.NULL);
+ resourcePathLabel.setText(Messages.DawnCreateNewResourceWizardPage_8);
+
+ resourcePathComposite = new Text(this, SWT.BORDER | SWT.SINGLE);
+ resourcePathComposite.setText(""); //$NON-NLS-1$
+ resourcePathComposite.addKeyListener(new KeyListener()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ getValidator().validate();
+ }
+
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ resourcePathComposite.setLayoutData(gd);
+ return gd;
+ }
+
+ public void createAutomaticResourceName()
+ {
+ int i = 2;
+ while (i < 30 && view.hasResource(getURI().path()))
+ {
+ resourceNameComposite.setText(getResourceNamePrefix() + i + "." + fileExtension); //$NON-NLS-1$
+ i++;
+ }
+
+ if (i < 30)
+ {
+ return;
+ }
+ // if we have tried 30 times to find a new resource name and still not succeeded just add a timestamp to the name
+ resourceNameComposite.setText(getResourceNamePrefix() + new Date().getTime() + "." + fileExtension); //$NON-NLS-1$
+ }
+
+ public URI getURI()
+ {
+ String resourcePath = getResourcePath();
+ if (resourcePath.length() > 0)
+ {
+ if (resourcePath.startsWith("/")) //$NON-NLS-1$
+ {
+ resourcePath = resourcePath.substring(1, resourcePath.length());
+ }
+ if (!resourcePath.endsWith("/")) //$NON-NLS-1$
+ {
+ resourcePath = resourcePath + "/"; //$NON-NLS-1$
+ }
+ }
+
+ String resourceName = getResourceName();
+ String authority = PreferenceConstants.getRepositoryName();
+ URI uri = URI.createURI("cdo://" + authority + "/" + resourcePath + resourceName); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return uri;
+ }
+
+ public String getDefaultName()
+ {
+ return getResourceNamePrefix();
+ }
+
+ public void showResources(boolean showResources)
+ {
+ selectCDOResourceNodeComposite.setShowResources(showResources);
+ }
+
+ public void setResourceNamePrefix(String resourceNamePrefix)
+ {
+ this.resourceNamePrefix = resourceNamePrefix;
+ }
+
+ public String getResourceNamePrefix()
+ {
+ return resourceNamePrefix;
+ }
+
+ public void setValidator(ResourceChooserValidator validator)
+ {
+ this.validator = validator;
+ }
+
+ public ResourceChooserValidator getValidator()
+ {
+ return validator;
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ public class ResourceChooserValidator
+ {
+ public static final int VALIDATION_NONE = 0;
+
+ public static final int VALIDATION_WARN = 1;
+
+ public static final int VALIDATION_ERROR = 2;
+
+ private int resourceValidationType = VALIDATION_ERROR;
+
+ private boolean valid;
+
+ private int messageType = IMessageProvider.NONE;
+
+ private String message;
+
+ private ValidationListener validationListener;
+
+ public ResourceChooserValidator()
+ {
+ }
+
+ public void validate()
+ {
+ internalValidate();
+ if (validationListener != null)
+ {
+ validationListener.validationFinished();
+ }
+ }
+
+ private void internalValidate()
+ {
+ setValid(true);
+
+ if (getResourceName().length() == 0)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_10, IMessageProvider.ERROR);
+ setValid(false);
+ return;
+ }
+
+ if (!getResourceName().endsWith("." + fileExtension))
+ {
+ setValid(false);
+ setMessage(Messages.CDOResourceNodeChooserComposite_1 + fileExtension, IMessageProvider.ERROR);
+ return;
+ }
+
+ if (view != null && getResourceValidationType() != VALIDATION_NONE)
+ {
+ try
+ {
+ if (view.hasResource(getURI().path()))
+ {
+ if (getResourceValidationType() == VALIDATION_WARN)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_11, IMessageProvider.WARNING);
+ setMessageType(IMessageProvider.WARNING);
+ setValid(true);
+ return;
+ }
+ else if (getResourceValidationType() == VALIDATION_ERROR)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_12, IMessageProvider.ERROR);
+ setValid(false);
+ setMessageType(IMessageProvider.ERROR);
+ return;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ setMessage(e.getMessage());
+ setMessageType(IMessageProvider.ERROR);
+ }
+ }
+ if (isValid())
+ {
+ setMessage(null);
+ setMessageType(IMessageProvider.NONE);
+ }
+ }
+
+ private void setMessage(String message, int type)
+ {
+ setMessage(message);
+ setMessageType(type);
+ }
+
+ public void setValid(boolean valid)
+ {
+ this.valid = valid;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessageType(int messageType)
+ {
+ this.messageType = messageType;
+ }
+
+ public int getMessageType()
+ {
+ return messageType;
+ }
+
+ public void setResourceValidationType(int resourceValidationType)
+ {
+ this.resourceValidationType = resourceValidationType;
+ }
+
+ public int getResourceValidationType()
+ {
+ return resourceValidationType;
+ }
+
+ public void setValidationListener(ValidationListener validationListener)
+ {
+ this.validationListener = validationListener;
+ }
+
+ public ValidationListener getValidationListener()
+ {
+ return validationListener;
+ }
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ public static interface ValidationListener
+ {
+ public void validationFinished();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java
index 59201394cc..2c929918fb 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java
@@ -1,147 +1,147 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui.composites;
-
-import org.eclipse.emf.cdo.dawn.ui.views.DawnWizardPageItemProvider;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.container.IPluginContainer;
-import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
-import org.eclipse.net4j.util.ui.views.IElementFilter;
-
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Martin Fluegge
- * @since 1.0
- */
-public class CDOResourceNodeSelectionWidget extends Composite
-{
- private ContainerItemProvider> itemProvider;
-
- private ShowResourcesViewFilter viewFilter;
-
- private TreeViewer viewer;
-
- public CDOResourceNodeSelectionWidget(Composite parent, int style)
- {
- super(parent, style);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 0;
- setLayout(layout);
- init();
- }
-
- public void setShowResources(boolean showResources)
- {
- viewFilter.setShowResources(showResources);
- }
-
- protected void init()
- {
- viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- itemProvider = createContainerItemProvider();
- viewer.setContentProvider(createContentProvider());
- viewer.setLabelProvider(createLabelProvider());
- viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setInput(getManagedContainer());
-
- viewFilter = new ShowResourcesViewFilter();
- viewer.addFilter(viewFilter);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- viewer.addSelectionChangedListener(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- viewer.removeSelectionChangedListener(listener);
- }
-
- protected IManagedContainer getManagedContainer()
- {
- return IPluginContainer.INSTANCE;
- }
-
- protected IContentProvider createContentProvider()
- {
- return itemProvider;
- }
-
- protected IBaseLabelProvider createLabelProvider()
- {
- ILabelDecorator labelDecorator = createLabelDecorator();
- return new DecoratingLabelProvider(itemProvider, labelDecorator);
- }
-
- protected ILabelDecorator createLabelDecorator()
- {
- return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
- }
-
- protected ContainerItemProvider> createContainerItemProvider()
- {
- return new DawnWizardPageItemProvider>(new IElementFilter()
- {
- public boolean filter(Object element)
- {
- return element instanceof CDOSession;
- }
- });
- }
-
- /**
- * @author Martin Fluegge
- */
- protected class ShowResourcesViewFilter extends ViewerFilter
- {
- private boolean showResources;
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
- if (element instanceof CDOResource)
- {
- return isShowResources();
- }
-
- return true;
- }
-
- public void setShowResources(boolean showResources)
- {
- this.showResources = showResources;
- }
-
- public boolean isShowResources()
- {
- return showResources;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.composites;
+
+import org.eclipse.emf.cdo.dawn.ui.views.DawnWizardPageItemProvider;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class CDOResourceNodeSelectionWidget extends Composite
+{
+ private ContainerItemProvider> itemProvider;
+
+ private ShowResourcesViewFilter viewFilter;
+
+ private TreeViewer viewer;
+
+ public CDOResourceNodeSelectionWidget(Composite parent, int style)
+ {
+ super(parent, style);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ setLayout(layout);
+ init();
+ }
+
+ public void setShowResources(boolean showResources)
+ {
+ viewFilter.setShowResources(showResources);
+ }
+
+ protected void init()
+ {
+ viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ itemProvider = createContainerItemProvider();
+ viewer.setContentProvider(createContentProvider());
+ viewer.setLabelProvider(createLabelProvider());
+ viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ viewer.setInput(getManagedContainer());
+
+ viewFilter = new ShowResourcesViewFilter();
+ viewer.addFilter(viewFilter);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ viewer.addSelectionChangedListener(listener);
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ viewer.removeSelectionChangedListener(listener);
+ }
+
+ protected IManagedContainer getManagedContainer()
+ {
+ return IPluginContainer.INSTANCE;
+ }
+
+ protected IContentProvider createContentProvider()
+ {
+ return itemProvider;
+ }
+
+ protected IBaseLabelProvider createLabelProvider()
+ {
+ ILabelDecorator labelDecorator = createLabelDecorator();
+ return new DecoratingLabelProvider(itemProvider, labelDecorator);
+ }
+
+ protected ILabelDecorator createLabelDecorator()
+ {
+ return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+ }
+
+ protected ContainerItemProvider> createContainerItemProvider()
+ {
+ return new DawnWizardPageItemProvider>(new IElementFilter()
+ {
+ public boolean filter(Object element)
+ {
+ return element instanceof CDOSession;
+ }
+ });
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ protected class ShowResourcesViewFilter extends ViewerFilter
+ {
+ private boolean showResources;
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (element instanceof CDOResource)
+ {
+ return isShowResources();
+ }
+
+ return true;
+ }
+
+ public void setShowResources(boolean showResources)
+ {
+ this.showResources = showResources;
+ }
+
+ public boolean isShowResources()
+ {
+ return showResources;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java
index a9b80eb746..7e325a3b1a 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java
@@ -1,31 +1,31 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui.handlers;
-
-import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
-import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public class LockObjectsHandler extends SelectionHandler
-{
- public Object execute(ExecutionEvent event) throws ExecutionException
- {
- ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().lockObjects(getSelectedObjects(event));
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.handlers;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class LockObjectsHandler extends SelectionHandler
+{
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().lockObjects(getSelectedObjects(event));
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java
index 112f15a92b..791a05a169 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2012 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:
- * Martin Fluegge - initial API and implementation
- */
-package org.eclipse.emf.cdo.dawn.ui.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public abstract class SelectionHandler extends AbstractHandler
-{
- protected List