Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 189826 Details for
Bug 298363
[ui]Catalog hyperlink detector quite confusing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
298363.patch (text/plain), 11.96 KB, created by
Nick Sandonato
on 2011-02-25 11:42:48 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Nick Sandonato
Created:
2011-02-25 11:42:48 EST
Size:
11.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.ui >Index: src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java,v >retrieving revision 1.39 >diff -u -r1.39 XMLUIMessages.java >--- src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java 14 Oct 2010 19:08:02 -0000 1.39 >+++ src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java 25 Feb 2011 16:37:53 -0000 >@@ -320,6 +320,7 @@ > public static String Use_XInclude; > public static String Honour_all_schema_locations; > public static String Open; >+ public static String Open_With; > public static String _UI_BUTTON_SORT; > public static String MarkupValidation_files_label; > public static String MarkupValidation_files; >Index: src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties,v >retrieving revision 1.50 >diff -u -r1.50 XMLUIPluginResources.properties >--- src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties 20 Dec 2010 19:30:55 -0000 1.50 >+++ src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties 25 Feb 2011 16:37:53 -0000 >@@ -348,6 +348,7 @@ > gotoMatchingTag_start=Start tag of element <{0}> > gotoMatchingTag_end=End tag of element <{0}> > Open=Open ''{0}'' >+Open_With=Open ''{0}'' with {1} > _UI_BUTTON_SORT=Sort > Validating_files=Validating files > Indicate_no_grammar_specified=Indicate when no &grammar is specified: >Index: src/org/eclipse/wst/xml/ui/internal/hyperlink/CatalogEntryHyperlink.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/CatalogEntryHyperlink.java,v >retrieving revision 1.2 >diff -u -r1.2 CatalogEntryHyperlink.java >--- src/org/eclipse/wst/xml/ui/internal/hyperlink/CatalogEntryHyperlink.java 23 Apr 2009 05:29:45 -0000 1.2 >+++ src/org/eclipse/wst/xml/ui/internal/hyperlink/CatalogEntryHyperlink.java 25 Feb 2011 16:37:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008 IBM Corporation and others. >+ * Copyright (c) 2008, 2011 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 >@@ -59,6 +59,9 @@ > if (fEntry.getURI().startsWith("jar:file:")) > return new URLStorageHyperlink(fHyperlinkRegion, new URL(fEntry.getURI())) { > public String getHyperlinkText() { >+ final String editorLabel = getEditorLabel(); >+ if (editorLabel != null) >+ return NLS.bind(XMLUIMessages.Open_With, fEntry.getKey(), editorLabel); > return NLS.bind(XMLUIMessages.Open, fEntry.getKey()); > } > }; >Index: src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java,v >retrieving revision 1.10 >diff -u -r1.10 ExternalFileHyperlink.java >--- src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java 13 Jul 2010 15:33:17 -0000 1.10 >+++ src/org/eclipse/wst/xml/ui/internal/hyperlink/ExternalFileHyperlink.java 25 Feb 2011 16:37:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2010 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -11,12 +11,18 @@ > package org.eclipse.wst.xml.ui.internal.hyperlink; > > import java.io.File; >+import java.io.IOException; >+import java.io.InputStream; > > import org.eclipse.core.filesystem.EFS; > import org.eclipse.core.filesystem.IFileStore; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.content.IContentType; > 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.IWorkbenchPage; > import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >@@ -54,9 +60,41 @@ > if (path.length() > 60) { > path = path.substring(0, 25) + "..." + path.substring(path.length() - 25, path.length()); > } >+ final String editorLabel = getEditorLabel(); >+ if (editorLabel != null) >+ return NLS.bind(XMLUIMessages.Open_With, path, editorLabel); > return NLS.bind(XMLUIMessages.Open, path); > } > >+ private String getEditorLabel() { >+ final IFileStore store = EFS.getLocalFileSystem().getStore(fHyperlinkFile.toURI()); >+ final String name = store.fetchInfo().getName(); >+ >+ if (name == null) { >+ return null; >+ } >+ >+ IContentType contentType= null; >+ try { >+ InputStream is = null; >+ try { >+ is = store.openInputStream(EFS.NONE, null); >+ contentType= Platform.getContentTypeManager().findContentTypeFor(is, name); >+ } finally { >+ if (is != null) { >+ is.close(); >+ } >+ } >+ } catch (CoreException ex) { >+ // continue without content type >+ } catch (IOException ex) { >+ // continue without content type >+ } >+ >+ final IEditorDescriptor descriptor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(name, contentType); >+ return descriptor != null ? descriptor.getLabel() : null; >+ } >+ > public void open() { > if (fHyperlinkFile != null) { > try { >Index: src/org/eclipse/wst/xml/ui/internal/hyperlink/URLStorageHyperlink.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/URLStorageHyperlink.java,v >retrieving revision 1.1 >diff -u -r1.1 URLStorageHyperlink.java >--- src/org/eclipse/wst/xml/ui/internal/hyperlink/URLStorageHyperlink.java 23 Apr 2009 05:29:43 -0000 1.1 >+++ src/org/eclipse/wst/xml/ui/internal/hyperlink/URLStorageHyperlink.java 25 Feb 2011 16:37:53 -0000 >@@ -1,5 +1,16 @@ >+/******************************************************************************* >+ * Copyright (c) 2009, 2011 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.IOException; > import java.io.InputStream; > import java.net.URL; > >@@ -8,7 +19,9 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.content.IContentType; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.IRegion; > import org.eclipse.jface.text.hyperlink.IHyperlink; >@@ -152,7 +165,46 @@ > * @see org.eclipse.jface.text.hyperlink.IHyperlink#getHyperlinkText() > */ > public String getHyperlinkText() { >- return NLS.bind(XMLUIMessages.Open, fURL.toString()); >+ String path = fURL.toString(); >+ if (path.length() > 60) { >+ path = path.substring(0, 25) + "..." + path.substring(path.length() - 25, path.length()); >+ } >+ final String editorLabel = getEditorLabel(); >+ if (editorLabel != null) >+ return NLS.bind(XMLUIMessages.Open_With, path, editorLabel); >+ return NLS.bind(XMLUIMessages.Open, path); >+ } >+ >+ protected String getEditorLabel() { >+ IEditorDescriptor descriptor = getEditorDescriptor(); >+ return descriptor != null ? descriptor.getLabel() : null; >+ } >+ >+ private IEditorDescriptor getEditorDescriptor() { >+ final URLStorage storage = new URLStorage(fURL); >+ final String path = fURL.getPath(); >+ String name = null; >+ if (path != null) >+ name = new Path(fURL.getPath()).lastSegment(); >+ >+ IContentType contentType= null; >+ try { >+ InputStream is = null; >+ try { >+ is = storage.getContents(); >+ contentType= Platform.getContentTypeManager().findContentTypeFor(is, name); >+ } finally { >+ if (is != null) { >+ is.close(); >+ } >+ } >+ } catch (CoreException ex) { >+ // continue without content type >+ } catch (IOException ex) { >+ // continue without content type >+ } >+ >+ return PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(name, contentType); > } > > /* >@@ -163,9 +215,8 @@ > public void open() { > if (fURL != null) { > IEditorInput input = new StorageEditorInput(new URLStorage(fURL)); >- IEditorDescriptor descriptor; > try { >- descriptor = IDE.getEditorDescriptor(input.getName()); >+ final IEditorDescriptor descriptor = getEditorDescriptor(); > if (descriptor != null) { > IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); > IDE.openEditor(page, input, descriptor.getId(), true); >Index: src/org/eclipse/wst/xml/ui/internal/hyperlink/WorkspaceFileHyperlink.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/WorkspaceFileHyperlink.java,v >retrieving revision 1.6 >diff -u -r1.6 WorkspaceFileHyperlink.java >--- src/org/eclipse/wst/xml/ui/internal/hyperlink/WorkspaceFileHyperlink.java 23 Apr 2009 05:29:45 -0000 1.6 >+++ src/org/eclipse/wst/xml/ui/internal/hyperlink/WorkspaceFileHyperlink.java 25 Feb 2011 16:37:53 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -11,9 +11,11 @@ > package org.eclipse.wst.xml.ui.internal.hyperlink; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.CoreException; > 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.IEditorPart; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.PartInitException; >@@ -71,9 +73,24 @@ > if (path.length() > 60) { > path = path.substring(0, 25) + "..." + path.substring(path.length() - 25, path.length()); > } >+ String editorLabel = null; >+ try { >+ editorLabel = getEditorLabel(); >+ } >+ catch (CoreException e) { >+ Logger.logException(e); >+ } >+ if (editorLabel != null) { >+ return NLS.bind(XMLUIMessages.Open_With, path, editorLabel); >+ } > return NLS.bind(XMLUIMessages.Open, path); > } > >+ private String getEditorLabel() throws CoreException { >+ final IEditorDescriptor defaultEditor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(fFile.getName(), fFile.getContentDescription().getContentType()); >+ return defaultEditor != null ? defaultEditor.getLabel() : null; >+ } >+ > public void open() { > if ((fFile != null) && fFile.exists()) { > try {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 298363
:
154907
|
161874
|
185754
| 189826