Author: mareshkau
Date: 2009-06-19 14:05:07 -0400 (Fri, 19 Jun 2009)
New Revision: 16083
Added:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4509
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2009-06-19 18:04:07
UTC (rev 16082)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2009-06-19 18:05:07
UTC (rev 16083)
@@ -33,7 +33,7 @@
<partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
</contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
- <partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
</contentType>
</hyperlinkPartitioner>
@@ -99,7 +99,7 @@
<partitionType
id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
</contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
- <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"
/>
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"
/>
</contentType>
</hyperlinkPartitioner>
@@ -483,7 +483,7 @@
<axis path="/web-app/filter/filter-class/" />
<axis path="/web-app/servlet/servlet-class/" />
<axis path="/web-app/listener/listener-class/" />
- <axis path="/web-app/resource-env-ref/resource-env-ref-type/"
/>
+ <axis path="/web-app/resource-env-ref/resource-env-ref-type/"
/>
<!-- Web.xml -->
<!-- TLD Files -->
@@ -636,12 +636,36 @@
</contentType>
</hyperlinkPartitioner>
<!-- End of TLD files hyperlink partitioners -->
+ <!--Maksim Areshkau, partitioner for *.taglib.xml files -->
+ <hyperlinkPartitioner
+
class="org.jboss.tools.common.text.ext.hyperlink.TaglibDefinitionFilesHyperlinkPartitioner"
+
id="org.jboss.tools.common.text.ext.hyperlink.TaglibDefinitionFilesHyperlinkPartitioner">
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType
id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/facelet-taglib/tag/source">
+ </axis>
+ </partitionType>
+ </contentType>
+ </hyperlinkPartitioner>
+ <!--End of partiotioner for *.taglib.xml files -->
</extension>
<extension
point="org.jboss.tools.common.text.ext.hyperlink"
id="org.jboss.tools.common.text.ext.hyperlink"
name="org.jboss.tools.common.text.ext.hyperlink">
+
+
+ <hyperlink
+
class="org.jboss.tools.common.text.ext.hyperlink.xml.FaceletSourceTagHyperlink"
+
id="org.jboss.tools.common.text.ext.hyperlink.xml.FaceletSourceTagHyperlink">
+ <contenttypeidentifier
+ id="org.jboss.tools.common.model.ui.xml">
+ <partitiontype
+ id="org.jboss.tools.common.text.ext.xml.TAGLIB_XML" >
+ </partitiontype>
+ </contenttypeidentifier>
+ </hyperlink>
<hyperlink
class="org.jboss.tools.common.text.ext.hyperlink.xml.XMLDoctypeHyperlink"
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2009-06-19
18:04:07 UTC (rev 16082)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -53,7 +53,7 @@
}
}
- private String getFilePath(IRegion region) {
+ protected String getFilePath(IRegion region) {
try {
return getDocument().get(region.getOffset(), region.getLength());
} catch (BadLocationException x) {
Added:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.ext.hyperlink;
+
+import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLTextHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class TaglibDefinitionFilesHyperlinkPartitioner extends
XMLTextHyperlinkPartitioner {
+
+ public static final String TAGLIB_XML_PARTITION =
"org.jboss.tools.common.text.ext.xml.TAGLIB_XML"; //$NON-NLS-1$
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion)
+ */
+ /**
+ * @see
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
+ */
+ @Override
+ public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null) return false;
+
+ Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ return (n instanceof Text);
+ } finally {
+ smw.dispose();
+ }
+ }
+
+ @Override
+ protected String getPartitionType() {
+ return TAGLIB_XML_PARTITION;
+ }
+}
Added:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.ext.hyperlink.xml;
+
+import org.eclipse.jdt.internal.core.JarEntryFile;
+import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class FaceletSourceTagHyperlink extends LinkHyperlink{
+
+
+ @Override
+ protected void doHyperlink(IRegion region) {
+ IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart editorPart = page.getActiveEditor();
+ // if we open taglib definition in jar file
+ if( editorPart.getEditorInput() instanceof JarEntryEditorInput) {
+ String fileToOpenName =getFilePath(region);
+ if(fileToOpenName!=null) {
+ JarEntryEditorInput currentEditorInput = (JarEntryEditorInput)
editorPart.getEditorInput();
+ //remove whitespaces and first '/'
+ fileToOpenName = fileToOpenName.trim();
+ if(fileToOpenName.indexOf('/')==0) {
+ fileToOpenName=fileToOpenName.substring(1);
+ }
+ JarEntryFile fileToOpen = new JarEntryFile(fileToOpenName);
+ fileToOpen.setParent(((JarEntryFile)currentEditorInput.getStorage()).getPackageFragmentRoot());
+ JarEntryEditorInput editorInputToOpenEditor= new JarEntryEditorInput(fileToOpen);
+ IEditorPart openedEditor = openFileInEditor(editorInputToOpenEditor,
+ fileToOpen.getName());
+ if(openedEditor==null) {
+ openFileFailed();
+ }
+ }
+ } else {
+ super.doHyperlink(region);
+ }
+ }
+
+}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2009-06-19
18:04:07 UTC (rev 16082)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -27,11 +27,12 @@
*
*/
public class XMLTextHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements
IHyperlinkPartitionRecognizer {
- public static final String XML_TEXT_PARTITION =
"org.jboss.tools.common.text.ext.xml.XML_TEXT";
+ public static final String XML_TEXT_PARTITION =
"org.jboss.tools.common.text.ext.xml.XML_TEXT"; //$NON-NLS-1$
/**
* @see
com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
+ @Override
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
@@ -44,7 +45,7 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
- String type = XML_TEXT_PARTITION;
+ String type = getPartitionType();
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
if(start < 0 || end < start) return null;
@@ -74,5 +75,9 @@
smw.dispose();
}
}
+
+ protected String getPartitionType() {
+ return XML_TEXT_PARTITION;
+ }
}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2009-06-19
18:04:07 UTC (rev 16082)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -23,6 +23,7 @@
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkBuilder;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
@@ -59,7 +60,6 @@
*/
public IHyperlink[] getHyperlinks(ITextViewer textViewer, IRegion region, String
contentType, String partitionType) {
ArrayList hyperlinks = new ArrayList();
-
// determine the current partition
if (textViewer != null && textViewer.getDocument() != null) {
// query HyperlinkBuilder and get the list of open ons for the
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2009-06-19
18:04:07 UTC (rev 16082)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2009-06-19
18:05:07 UTC (rev 16083)
@@ -25,7 +25,9 @@
org.jboss.tools.vpe.resref;bundle-version="2.0.0",
org.jboss.tools.common.el.ui;bundle-version="1.0.0",
org.jboss.tools.common.el.core;bundle-version="2.0.0",
- org.jboss.tools.common.model.ui;bundle-version="2.0.0"
+ org.jboss.tools.common.model.ui;bundle-version="2.0.0",
+ org.eclipse.wst.xml.ui;bundle-version="1.1.0",
+ org.eclipse.jdt.ui;bundle-version="3.5.0"
Bundle-ClassPath: jsf-test.jar
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-06-19
18:04:07 UTC (rev 16082)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -60,6 +60,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4179Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4337Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4373Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4509Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -84,6 +85,7 @@
public static final String IMPORT_PROJECT_NAME = "jsfTest"; //$NON-NLS-1$
public static final String IMPORT_JSF_20_PROJECT_NAME = "jsf2test";
//$NON-NLS-1$
public static final String IMPORT_CUSTOM_FACELETS_PROJECT =
"customFaceletsTestProject";//$NON-NLS-1$
+ public static final String IMPORT_JBIDE3247_PROJECT_NAME = "JBIDE3247";
//$NON-NLS-1$
public static Test suite() {
@@ -146,7 +148,7 @@
suite.addTestSuite(JBIDE3969Test.class);
suite.addTestSuite(JBIDE4337Test.class);
suite.addTestSuite(JBIDE4179Test.class);
-
+ suite.addTestSuite(JBIDE4509Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
@@ -166,6 +168,11 @@
customFaceletsTestProject.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
projectToImport.add(customFaceletsTestProject);
+ ImportBean jbide3247TestProject = new ImportBean();
+ jbide3247TestProject.setImportProjectName(JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
+ jbide3247TestProject.setImportProjectPath(JsfTestPlugin.getPluginResourcePath());
+ projectToImport.add(jbide3247TestProject);
+
return new VpeTestSetup(suite, projectToImport);
}
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java 2009-06-19
18:05:07 UTC (rev 16083)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorRegistry;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class JBIDE4509Test extends VpeTest{
+
+ public JBIDE4509Test(String name) {
+ super(name);
+ }
+ //tests openOn from taglib
+ public void testOpenOnTaglibDefinitionFile() throws Throwable {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT);
+ IFile file = (IFile)
project.findMember("WebContent/tags/facelets.taglib.xml"); //$NON-NLS-1$
+ IEditorInput input = new FileEditorInput(file);
+ MultiPageEditorPart editorPart = (MultiPageEditorPart) PlatformUI.getWorkbench().
+ getActiveWorkbenchWindow().
+ getActivePage().
+ openEditor(input,getEditorId(file.getName()));
+ IEditorPart[] editorParts = editorPart.findEditors(input);
+ editorPart.setActiveEditor(editorParts[0]);
+ StructuredTextEditor textEditor = (StructuredTextEditor) editorParts[0];
+
+ int openOnPosition = TestUtil.getLinePositionOffcet(textEditor.getTextViewer(),12,17);
+ //hack to get hyperlinks detectors, no other was have been founeded
+ Method method =
AbstractTextEditor.class.getDeclaredMethod("getSourceViewerConfiguration");
//$NON-NLS-1$
+ method.setAccessible(true);
+ SourceViewerConfiguration sourceViewerConfiguration = (SourceViewerConfiguration)
method.invoke(textEditor);
+ IHyperlinkDetector[] hyperlinkDetectors =
sourceViewerConfiguration.getHyperlinkDetectors(textEditor.getTextViewer());
+ for (IHyperlinkDetector iHyperlinkDetector : hyperlinkDetectors) {
+ IHyperlink [] hyperLinks =
iHyperlinkDetector.detectHyperlinks(textEditor.getTextViewer(), new
Region(openOnPosition,0), false);
+ if(hyperLinks!=null && hyperLinks.length>0 && hyperLinks[0]
instanceof AbstractHyperlink) {
+ AbstractHyperlink abstractHyperlink = (AbstractHyperlink) hyperLinks[0];
+ abstractHyperlink.open();
+ break;
+ }
+ }
+ IEditorPart activeEditor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ assertEquals("Active page should be ","paginator.xhtml",
activeEditor.getEditorInput().getName()); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ private static String getEditorId(String filename) {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IEditorRegistry editorRegistry = workbench.getEditorRegistry();
+ IEditorDescriptor descriptor = editorRegistry
+ .getDefaultEditor(filename);
+ if (descriptor != null)
+ return descriptor.getId();
+ return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
+ }
+}