Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsandonato2010-07-13 15:33:20 +0000
committernsandonato2010-07-13 15:33:20 +0000
commitb8d79f5ec0e03babbb4ae7ea1add44d5ae4ae57b (patch)
tree6586ab51fe6ee416965442572bcf0df2f057bf3e /bundles/org.eclipse.wst.xml.ui
parentd9d14ebb8629eba8518214ba16961607a8d31f9a (diff)
downloadwebtools.sourceediting-b8d79f5ec0e03babbb4ae7ea1add44d5ae4ae57b.tar.gz
webtools.sourceediting-b8d79f5ec0e03babbb4ae7ea1add44d5ae4ae57b.tar.xz
webtools.sourceediting-b8d79f5ec0e03babbb4ae7ea1add44d5ae4ae57b.zip
[177429] [api]use base's new api for opening external files (at least hyperlinking)
Diffstat (limited to 'bundles/org.eclipse.wst.xml.ui')
-rw-r--r--bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileEditorInput.java171
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java16
3 files changed, 8 insertions, 182 deletions
diff --git a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
index 0784183929..cefa64157b 100644
--- a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
@@ -57,6 +57,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
org.eclipse.wst.xml.core;bundle-version="[1.1.500,1.2.0)",
org.eclipse.wst.common.ui;bundle-version="[1.1.400,1.2.0)",
org.eclipse.wst.validation;bundle-version="[1.2.100,1.3.0)",
- org.eclipse.core.expressions;bundle-version="[3.4.100,4.0.0)"
+ org.eclipse.core.expressions;bundle-version="[3.4.100,4.0.0)",
+ org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)"
Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo"
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileEditorInput.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileEditorInput.java
deleted file mode 100644
index 86e85d05a2..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileEditorInput.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.hyperlink;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPathEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.editors.text.ILocationProvider;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * EditorInput for external files. Copied from
- * org.eclipse.ui.internal.editors.text.JavaFileEditorInput
- */
-class ExternalFileEditorInput implements IEditorInput, ILocationProvider {
- // copies of this class exist in:
- // org.eclipse.wst.xml.ui.internal.hyperlink
- // org.eclipse.wst.html.ui.internal.hyperlink
- // org.eclipse.jst.jsp.ui.internal.hyperlink
-
- /**
- * The workbench adapter which simply provides the label.
- */
- private class WorkbenchAdapter implements IWorkbenchAdapter {
- /*
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object o) {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object o) {
- return ((ExternalFileEditorInput) o).getName();
- }
-
- /*
- * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object)
- */
- public Object getParent(Object o) {
- return null;
- }
- }
-
- private File fFile;
- private WorkbenchAdapter fWorkbenchAdapter = new WorkbenchAdapter();
-
- public ExternalFileEditorInput(File file) {
- super();
- fFile = file;
- fWorkbenchAdapter = new WorkbenchAdapter();
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- public boolean exists() {
- return fFile.exists();
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- public String getName() {
- return fFile.getName();
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- return fFile.getAbsolutePath();
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ILocationProvider.class.equals(adapter)) {
- return this;
- }
- if (IWorkbenchAdapter.class.equals(adapter)) {
- return fWorkbenchAdapter;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /*
- * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
- */
- public IPath getPath(Object element) {
- if (element instanceof ExternalFileEditorInput) {
- ExternalFileEditorInput input = (ExternalFileEditorInput) element;
- return Path.fromOSString(input.fFile.getAbsolutePath());
- }
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IPathEditorInput#getPath()
- * @since 3.1
- */
- public IPath getPath() {
- return Path.fromOSString(fFile.getAbsolutePath());
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
-
- if (o instanceof ExternalFileEditorInput) {
- ExternalFileEditorInput input = (ExternalFileEditorInput) o;
- return fFile.equals(input.fFile);
- }
-
- if (o instanceof IPathEditorInput) {
- IPathEditorInput input = (IPathEditorInput) o;
- return getPath().equals(input.getPath());
- }
-
- return false;
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fFile.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java
index 6761969c3c..1f10459ffd 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation 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
@@ -12,11 +12,11 @@ package org.eclipse.wst.xml.ui.internal.hyperlink;
import java.io.File;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -59,14 +59,10 @@ class ExternalFileHyperlink implements IHyperlink {
public void open() {
if (fHyperlinkFile != null) {
- IEditorInput input = new ExternalFileEditorInput(fHyperlinkFile);
- IEditorDescriptor descriptor;
try {
- descriptor = IDE.getEditorDescriptor(input.getName(), true);
- if (descriptor != null) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, input, descriptor.getId(), true);
- }
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IFileStore store = EFS.getLocalFileSystem().getStore(fHyperlinkFile.toURI());
+ IDE.openEditorOnFileStore(page, store) ;
}
catch (PartInitException e) {
Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);

Back to the top