Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-09-01 20:43:40 +0000
committerEike Stepper2012-09-01 20:43:40 +0000
commit49f2f4828381a028335fac176e64b6ee06a8d24d (patch)
tree30d4601b8001e927a1bc5f9e58353915ec857044 /plugins
parentb56489f9a613d822aaa9e876635294e6341f548f (diff)
downloadcdo-49f2f4828381a028335fac176e64b6ee06a8d24d.tar.gz
cdo-49f2f4828381a028335fac176e64b6ee06a8d24d.tar.xz
cdo-49f2f4828381a028335fac176e64b6ee06a8d24d.zip
[388567] [UI] Support CDOTextResource and CDOBinaryResource in the generic UI
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388567
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/plugin.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOLobEditorInput.java (renamed from plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOLobEditorInput.java)139
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java2
4 files changed, 94 insertions, 51 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch b/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
index 1d1912ade8..b9d815d629 100644
--- a/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
+++ b/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
@@ -27,7 +27,7 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m&#13;&#10;-Xmx1024m&#13;&#10;-Dosgi.console.enable.builtin=true"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
-<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.lucene@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common*2.8.0.v20120516-0416@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.emf.ecore*2.8.0.v20120516-0416@default:default,org.eclipse.emf.ecore.change*2.8.0.v20120516-0416@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.emf.ecore.xmi*2.8.0.v20120516-0416@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86_64@default:false,org.eclipse.equinox.security@default:default,org.eclipse.help.base@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi@-1:true,org.eclipse.platform@default:default,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.h2@default:default"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.lucene@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86_64@default:false,org.eclipse.equinox.security@default:default,org.eclipse.help.base@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi@-1:true,org.eclipse.platform@default:default,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.h2@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.admin@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.edit@default:default,org.eclipse.emf.cdo.examples.company.edit@default:default,org.eclipse.emf.cdo.examples.company@default:default,org.eclipse.emf.cdo.location@default:default,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.security.edit@default:default,org.eclipse.emf.cdo.security.editor@default:default,org.eclipse.emf.cdo.security@default:default,org.eclipse.emf.cdo.server.db@default:default,org.eclipse.emf.cdo.server.net4j@default:default,org.eclipse.emf.cdo.server@default:default,org.eclipse.emf.cdo.team@default:default,org.eclipse.emf.cdo.ui.admin@default:default,org.eclipse.emf.cdo.ui.efs@default:default,org.eclipse.emf.cdo.ui.ide@default:default,org.eclipse.emf.cdo.ui.location@default:default,org.eclipse.emf.cdo.ui.shared@default:default,org.eclipse.emf.cdo.ui.workspace@default:default,org.eclipse.emf.cdo.ui@default:default,org.eclipse.emf.cdo.workspace.efs@default:default,org.eclipse.emf.cdo.workspace@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.jvm@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.ui.shared@default:default,org.eclipse.net4j.ui@default:default,org.eclipse.net4j.util.ui@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
diff --git a/plugins/org.eclipse.emf.cdo.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
index bb5cfd27d5..134c6898e3 100644
--- a/plugins/org.eclipse.emf.cdo.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.ui/plugin.xml
@@ -149,7 +149,7 @@
id="org.eclipse.core.filesystem.cdo.workspace"
point="org.eclipse.core.filesystem.filesystems">
<filesystem scheme="cdo.lob">
- <run class="org.eclipse.emf.cdo.internal.ui.views.CDOLobEditorInput$LobFileSystem"/>
+ <run class="org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput$LobFileSystem"/>
</filesystem>
</extension>
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOLobEditorInput.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOLobEditorInput.java
index 75dcfbea6c..0d58842a14 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOLobEditorInput.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOLobEditorInput.java
@@ -8,7 +8,7 @@
* Contributors:
* Eike Stepper - initial API and implementation
*/
-package org.eclipse.emf.cdo.internal.ui.views;
+package org.eclipse.emf.cdo.internal.ui;
import org.eclipse.emf.cdo.common.lob.CDOBlob;
import org.eclipse.emf.cdo.common.lob.CDOClob;
@@ -56,7 +56,7 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
{
private static final String SCHEME = "cdo.lob";
- private static final Map<CDOLobEditorInput, URI> inputs = new WeakHashMap<CDOLobEditorInput, URI>();
+ private static final Map<CDOLobEditorInput, LobFileStore> fileStores = new WeakHashMap<CDOLobEditorInput, LobFileStore>();
private static int lastID;
@@ -77,9 +77,9 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
throw WrappedException.wrap(ex);
}
- synchronized (inputs)
+ synchronized (fileStores)
{
- inputs.put(this, uri);
+ fileStores.put(this, null);
}
}
@@ -118,6 +118,49 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
return uri;
}
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (resource == null ? 0 : resource.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+
+ if (obj == null)
+ {
+ return false;
+ }
+
+ if (!(obj instanceof CDOLobEditorInput))
+ {
+ return false;
+ }
+
+ CDOLobEditorInput other = (CDOLobEditorInput)obj;
+ if (resource == null)
+ {
+ if (other.resource != null)
+ {
+ return false;
+ }
+ }
+ else if (!resource.equals(other.resource))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
/**
* @author Eike Stepper
*/
@@ -126,7 +169,27 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
@Override
public IFileStore getStore(URI uri)
{
- return new LobFileStore(uri);
+ synchronized (fileStores)
+ {
+ for (Entry<CDOLobEditorInput, LobFileStore> entry : fileStores.entrySet())
+ {
+ CDOLobEditorInput editorInput = entry.getKey();
+ if (uri.equals(editorInput.getURI()))
+ {
+ LobFileStore store = entry.getValue();
+ if (store == null)
+ {
+ CDOFileResource<?> resource = editorInput.getResource();
+ store = new LobFileStore(resource, uri);
+ fileStores.put(editorInput, store);
+ }
+
+ return store;
+ }
+ }
+ }
+
+ throw new IllegalStateException("No editor input is cached for " + uri);
}
}
@@ -137,14 +200,15 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
{
private static final String[] NO_CHILDREN = new String[0];
- private final URI uri;
-
private CDOFileResource<?> resource;
+ private final URI uri;
+
private FileInfo info;
- public LobFileStore(URI uri)
+ public LobFileStore(CDOFileResource<?> resource, URI uri)
{
+ this.resource = resource;
this.uri = uri;
}
@@ -154,43 +218,6 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
return uri;
}
- private CDOFileResource<?> getResource()
- {
- if (resource == null)
- {
- synchronized (inputs)
- {
- for (Entry<CDOLobEditorInput, URI> entry : inputs.entrySet())
- {
- if (uri.equals(entry.getValue()))
- {
- resource = entry.getKey().getResource();
- break;
- }
- }
- }
- }
-
- return resource;
- }
-
- private String getEncoding(CDOTextResource textResource)
- {
- String encoding = textResource.getEncoding();
- if (encoding == null)
- {
- try
- {
- encoding = ResourcesPlugin.getWorkspace().getRoot().getDefaultCharset();
- }
- catch (CoreException ex)
- {
- OM.LOG.error(ex);
- }
- }
- return encoding;
- }
-
@Override
public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException
{
@@ -213,7 +240,6 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
{
try
{
- CDOFileResource<?> resource = getResource();
if (resource instanceof CDOTextResource)
{
CDOTextResource textResource = (CDOTextResource)resource;
@@ -254,7 +280,6 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
@Override
public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException
{
- final CDOFileResource<?> resource = getResource();
return new ByteArrayOutputStream()
{
@Override
@@ -282,7 +307,7 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
@Override
public String getName()
{
- return getResource().getName();
+ return resource.getName();
}
@Override
@@ -302,5 +327,23 @@ public class CDOLobEditorInput extends PlatformObject implements IURIEditorInput
{
return NO_CHILDREN; // This is a flat file system
}
+
+ private String getEncoding(CDOTextResource textResource)
+ {
+ String encoding = textResource.getEncoding();
+ if (encoding == null)
+ {
+ try
+ {
+ encoding = ResourcesPlugin.getWorkspace().getRoot().getDefaultCharset();
+ }
+ catch (CoreException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+
+ return encoding;
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
index 092e9e8a09..5fc2f47c53 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
@@ -14,9 +14,9 @@ package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.eresource.CDOFileResource;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceLeaf;
+import org.eclipse.emf.cdo.internal.ui.CDOLobEditorInput;
import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.internal.ui.views.CDOLobEditorInput;
import org.eclipse.emf.cdo.ui.CDOEditorUtil;
import org.eclipse.emf.cdo.view.CDOView;

Back to the top