diff options
author | Florian Thienel | 2014-03-14 19:07:01 +0000 |
---|---|---|
committer | Florian Thienel | 2014-03-16 13:00:34 +0000 |
commit | 8d649f67502c1befd008f09b851b2a6a628c7483 (patch) | |
tree | f3fba370fb85e1ef7dcc987c2ba189f571c7d6b2 | |
parent | 30a4a7ad2f7d895e472d8945c5dd0869141477d3 (diff) | |
download | org.eclipse.mylyn.docs.vex-8d649f67502c1befd008f09b851b2a6a628c7483.tar.gz org.eclipse.mylyn.docs.vex-8d649f67502c1befd008f09b851b2a6a628c7483.tar.xz org.eclipse.mylyn.docs.vex-8d649f67502c1befd008f09b851b2a6a628c7483.zip |
fix discouraged access warnings
To fix the "discouraged access" warnings, we need either do iron out the
x-friends in the bundle manifests or define access rules for some
internal WTP packages. WTP decided to not remove the "internal" from the
package name since this would break many already dependents. In fact
things like the URIResolver are publicly used since years and therefor
considered as public API.
Change-Id: Ia025462c27b4920ee8154dd0b3c9013dce6b8264
Signed-off-by: Florian Thienel <florian@thienel.org>
16 files changed, 83 insertions, 161 deletions
diff --git a/org.eclipse.vex.core.tests/.classpath b/org.eclipse.vex.core.tests/.classpath index c72d35a0..9ce3b1f6 100644 --- a/org.eclipse.vex.core.tests/.classpath +++ b/org.eclipse.vex.core.tests/.classpath @@ -1,7 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> + <accessrules> + <accessrule kind="accessible" pattern="**/wst/**/internal/**"/> + </accessrules> + </classpathentry> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="target/classes"/> </classpath> diff --git a/org.eclipse.vex.core.tests/META-INF/MANIFEST.MF b/org.eclipse.vex.core.tests/META-INF/MANIFEST.MF index cc1e3650..200f7704 100644 --- a/org.eclipse.vex.core.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.vex.core.tests/META-INF/MANIFEST.MF @@ -20,14 +20,14 @@ Require-Bundle: org.eclipse.vex.core;bundle-version="[1.1.0,2.0.0)", com.ibm.icu;bundle-version="50.1.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.vex.core.internal.core;x-internal:=true, - org.eclipse.vex.core.internal.css;x-internal:=true, - org.eclipse.vex.core.internal.dom;x-internal:=true, - org.eclipse.vex.core.internal.io;x-internal:=true, - org.eclipse.vex.core.internal.layout;x-internal:=true, - org.eclipse.vex.core.internal.validator;x-internal:=true, - org.eclipse.vex.core.internal.widget;x-internal:=true, - org.eclipse.vex.core.internal.widget.swt;x-internal:=true, +Export-Package: org.eclipse.vex.core.internal.core;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.css;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.dom;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.io;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.layout;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.validator;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.widget;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.widget.swt;x-friends:="org.eclipse.vex.ui.tests", org.eclipse.vex.core.tests Bundle-Localization: plugin Bundle-ClassPath: . diff --git a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/io/DocumentReaderTest.java b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/io/DocumentReaderTest.java index ca6aa007..f5f55308 100644 --- a/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/io/DocumentReaderTest.java +++ b/org.eclipse.vex.core.tests/src/org/eclipse/vex/core/internal/io/DocumentReaderTest.java @@ -4,7 +4,7 @@ * 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:
* Florian Thienel - initial API and implementation
* Carsten Hiesserich - do not add text nodes containing only whitespace when reading the document (bug 407803)
diff --git a/org.eclipse.vex.core/.classpath b/org.eclipse.vex.core/.classpath index c72d35a0..9ce3b1f6 100644 --- a/org.eclipse.vex.core/.classpath +++ b/org.eclipse.vex.core/.classpath @@ -1,7 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> + <accessrules> + <accessrule kind="accessible" pattern="**/wst/**/internal/**"/> + </accessrules> + </classpathentry> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="target/classes"/> </classpath> diff --git a/org.eclipse.vex.core/META-INF/MANIFEST.MF b/org.eclipse.vex.core/META-INF/MANIFEST.MF index a5b5143b..2bb22bb7 100644 --- a/org.eclipse.vex.core/META-INF/MANIFEST.MF +++ b/org.eclipse.vex.core/META-INF/MANIFEST.MF @@ -16,16 +16,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.9.0,4.0.0)", org.eclipse.xsd;bundle-version="[2.9.0,3.0.0)", org.eclipse.jface.text;bundle-version="[3.8.0,4.0.0)" Export-Package: org.eclipse.vex.core, - org.eclipse.vex.core.internal;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.core;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.css;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.dom;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.io;x-friends:="org.eclipse.vex.core.tests,org.eclipse.vex.ui", - org.eclipse.vex.core.internal.layout;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.undo;x-friends:="org.eclipse.vex.core.tests,org.eclipse.vex.ui", - org.eclipse.vex.core.internal.validator;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.widget;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", - org.eclipse.vex.core.internal.widget.swt;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests", + org.eclipse.vex.core.internal;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.core;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.css;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.dom;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.io;x-friends:="org.eclipse.vex.core.tests,org.eclipse.vex.ui,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.layout;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.undo;x-friends:="org.eclipse.vex.core.tests,org.eclipse.vex.ui,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.validator;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.widget;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", + org.eclipse.vex.core.internal.widget.swt;x-friends:="org.eclipse.vex.ui,org.eclipse.vex.core.tests,org.eclipse.vex.ui.tests", org.eclipse.vex.core.provisional.dom;uses:="org.eclipse.vex.core.internal.dom" Bundle-Activator: org.eclipse.vex.core.internal.VEXCorePlugin Bundle-Localization: plugin diff --git a/org.eclipse.vex.projectplan/plugin.xml b/org.eclipse.vex.projectplan/plugin.xml index 8aa388e1..d8cfc60f 100644 --- a/org.eclipse.vex.projectplan/plugin.xml +++ b/org.eclipse.vex.projectplan/plugin.xml @@ -18,10 +18,6 @@ name="http://www.eclipse.org/project/plan"
uri="xsd/plan.xsd">
</uri>
- <uri
- name="http://www.w3.org/1999/xhtml"
- uri="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">
- </uri>
</catalogContribution>
</extension>
<extension
diff --git a/org.eclipse.vex.sdk.feature/.project b/org.eclipse.vex.sdk.feature/.project index dfd77351..f517bd30 100644 --- a/org.eclipse.vex.sdk.feature/.project +++ b/org.eclipse.vex.sdk.feature/.project @@ -6,8 +6,13 @@ </projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>full,incremental,</triggers>
<arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value><project>/.externalToolBuilders/org.eclipse.pde.FeatureBuilder.launch</value>
+ </dictionary>
</arguments>
</buildCommand>
<buildCommand>
diff --git a/org.eclipse.vex.ui/.classpath b/org.eclipse.vex.ui/.classpath index 0b1bcf94..9ce3b1f6 100644 --- a/org.eclipse.vex.ui/.classpath +++ b/org.eclipse.vex.ui/.classpath @@ -1,7 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src/"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> + <accessrules> + <accessrule kind="accessible" pattern="**/wst/**/internal/**"/> + </accessrules> + </classpathentry> + <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="target/classes"/> </classpath> diff --git a/org.eclipse.vex.ui/META-INF/MANIFEST.MF b/org.eclipse.vex.ui/META-INF/MANIFEST.MF index 6f8ce842..31e9886b 100644 --- a/org.eclipse.vex.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.vex.ui/META-INF/MANIFEST.MF @@ -23,16 +23,24 @@ Require-Bundle: org.eclipse.vex.core;bundle-version="[1.1.0,2.0.0)", org.eclipse.wst.common.uriresolver;bundle-version="[1.2.0,2.0.0)", org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)" Export-Package: org.eclipse.vex.ui.internal;x-friends:="org.eclipse.vex.ui.tests", - org.eclipse.vex.ui.internal.config;x-internal:=true, - org.eclipse.vex.ui.internal.editor;x-friends:="org.eclipse.vex.docbook", - org.eclipse.vex.ui.internal.handlers;x-internal:=true, - org.eclipse.vex.ui.internal.namespace, - org.eclipse.vex.ui.internal.outline;x-friends:="org.eclipse.vex.docbook", - org.eclipse.vex.ui.internal.perspective;x-internal:=true, - org.eclipse.vex.ui.internal.property;x-internal:=true, - org.eclipse.vex.ui.internal.swt;x-internal:=true, - org.eclipse.vex.ui.internal.views;x-internal:=true, - org.eclipse.vex.ui.internal.wizards;x-internal:=true + org.eclipse.vex.ui.internal.config;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.editor; + x-friends:="org.eclipse.vex.docbook, + org.eclipse.vex.ui.tests, + org.eclipse.vex.xhtml, + org.eclipse.vex.dita", + org.eclipse.vex.ui.internal.handlers;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.namespace;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.outline; + x-friends:="org.eclipse.vex.docbook, + org.eclipse.vex.ui.tests, + org.eclipse.vex.xhtml, + org.eclipse.vex.dita", + org.eclipse.vex.ui.internal.perspective;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.property;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.swt;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.views;x-friends:="org.eclipse.vex.ui.tests", + org.eclipse.vex.ui.internal.wizards;x-friends:="org.eclipse.vex.ui.tests" Bundle-Localization: plugin Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/NewPluginProjectWizard.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/NewPluginProjectWizard.java index c5995a17..e1bb9f9b 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/NewPluginProjectWizard.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/NewPluginProjectWizard.java @@ -42,8 +42,6 @@ import org.eclipse.ui.dialogs.WizardNewProjectReferencePage; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.ide.undo.CreateProjectOperation; import org.eclipse.ui.ide.undo.WorkspaceUndoUtil; -import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; -import org.eclipse.ui.internal.ide.StatusUtil; import org.eclipse.ui.statushandlers.IStatusAdapterConstants; import org.eclipse.ui.statushandlers.StatusAdapter; import org.eclipse.ui.statushandlers.StatusManager; @@ -158,16 +156,15 @@ public class NewPluginProjectWizard extends Wizard implements INewWizard, IExecu final CoreException cause = (CoreException) t.getCause(); final StatusAdapter status; if (cause.getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) { - status = new StatusAdapter(StatusUtil.newStatus(IStatus.WARNING, - MessageFormat.format("The underlying file system is case insensitive. There is an existing project or directory that conflicts with ''{0}''.", newProjectHandle.getName()), - cause)); + status = new StatusAdapter(new Status(IStatus.WARNING, VexPlugin.ID, MessageFormat.format( + "The underlying file system is case insensitive. There is an existing project or directory that conflicts with ''{0}''.", newProjectHandle.getName()), cause)); } else { - status = new StatusAdapter(StatusUtil.newStatus(cause.getStatus().getSeverity(), "Creation Problems", cause)); + status = new StatusAdapter(new Status(cause.getStatus().getSeverity(), VexPlugin.ID, "Creation Problems", cause)); } status.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, "Creation Problems"); StatusManager.getManager().handle(status, StatusManager.BLOCK); } else { - final StatusAdapter status = new StatusAdapter(new Status(IStatus.WARNING, IDEWorkbenchPlugin.IDE_WORKBENCH, 0, MessageFormat.format("Internal error: {0}", t.getMessage()), t)); + final StatusAdapter status = new StatusAdapter(new Status(IStatus.WARNING, VexPlugin.ID, 0, MessageFormat.format("Internal error: {0}", t.getMessage()), t)); status.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, "Creation Problems"); StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.BLOCK); } diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/PluginProject.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/PluginProject.java index e4b73773..018f1144 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/PluginProject.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/config/PluginProject.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 John Krasnay and others. + * Copyright (c) 2004, 2014 John Krasnay 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: * John Krasnay - initial API and implementation * Igor Jacy Lino Campista - Java 5 warnings fixed (bug 311325) @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; @@ -58,16 +59,17 @@ public class PluginProject extends ConfigSource { @Override public URL getBaseUrl() { + return toURL(getProject()); + } + + private static URL toURL(final IResource resource) { try { - return getProject().getLocation().toFile().toURL(); + return resource.getLocation().toFile().toURI().toURL(); } catch (final MalformedURLException e) { throw new AssertionError(e); } } - /** - * @return the IProject associated with this plugin project. - */ public IProject getProject() { return project; } @@ -139,7 +141,7 @@ public class PluginProject extends ConfigSource { final IFile configXml = project.getFile(PLUGIN_XML); final DocumentBuilder builder = createDocumentBuilder(); try { - final URL url = configXml.getLocation().toFile().toURL(); + final URL url = toURL(configXml); return builder.parse(url.toString()); } catch (final SAXParseException e) { if (problemHandler != null) { diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java index fbcdfec1..c6d65a90 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/AbstractVexWidgetHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Holger Voormann and others. + * Copyright (c) 2009, 2014 Holger Voormann 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 @@ -25,7 +25,7 @@ import org.eclipse.vex.core.provisional.dom.IElement; import org.eclipse.vex.ui.internal.Messages; /** - * Abstract supper class of all command handlers which can be performed on a {@link VexWidget}. + * Abstract super class of all command handlers which can be performed on a {@link VexWidget}. * * @see IVexWidgetHandler */ @@ -49,7 +49,7 @@ public abstract class AbstractVexWidgetHandler extends AbstractHandler implement * @param dynamicLabelId * the ID of the message where <code>{0}</code> is replaced with the name of the current element */ - public void updateElement(final UIElement element, final Map parameters, final String windowScopeDynamicLabelId, final String partsiteScopeDynamicLabelId) { + public void updateElement(final UIElement element, @SuppressWarnings("rawtypes") final Map parameters, final String windowScopeDynamicLabelId, final String partsiteScopeDynamicLabelId) { final Object windowObject = parameters.get(IServiceScopes.WINDOW_SCOPE); if (!(windowObject instanceof IWorkbenchWindow)) { return; diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/ConvertElementHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/ConvertElementHandler.java index d74babd9..40d30299 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/ConvertElementHandler.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/ConvertElementHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 John Krasnay and others. + * Copyright (c) 2004, 2014 John Krasnay 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 @@ -33,7 +33,7 @@ public class ConvertElementHandler extends AbstractVexWidgetHandler implements I ContentAssist.openQuickFixContentAssist(widget); } - public void updateElement(final UIElement element, final Map parameters) { + public void updateElement(final UIElement element, @SuppressWarnings("rawtypes") final Map parameters) { updateElement(element, parameters, LABEL_ID, LABEL_ID); } diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/RemoveTagHandler.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/RemoveTagHandler.java index d5273acf..57cade69 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/RemoveTagHandler.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/handlers/RemoveTagHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2013 John Krasnay and others. + * Copyright (c) 2004, 2014 John Krasnay 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 @@ -26,14 +26,7 @@ public class RemoveTagHandler extends AbstractVexWidgetHandler implements IEleme /** ID of the corresponding remove element command. */ public static final String COMMAND_ID = "org.eclipse.vex.ui.RemoveTagCommand"; //$NON-NLS-1$ - /** - * The message ID of the command label which is in window scope displayed in the 'Remove' menu only. - */ private static final String WINDOW_SCOPE_DYNAMIC_LABEL_ID = "command.removeTag.inRemoveMenu.dynamicName"; //$NON-NLS-1$ - - /** - * The message ID of the command label which is in partsite scope displayed in the context menu. - */ private static final String PARTSITE_SCOPE_DYNAMIC_LABEL_ID = "command.removeTag.dynamicName"; //$NON-NLS-1$ @Override @@ -44,7 +37,7 @@ public class RemoveTagHandler extends AbstractVexWidgetHandler implements IEleme } @Override - public void updateElement(final UIElement element, final Map parameters) { + public void updateElement(final UIElement element, @SuppressWarnings("rawtypes") final Map parameters) { updateElement(element, parameters, WINDOW_SCOPE_DYNAMIC_LABEL_ID, PARTSITE_SCOPE_DYNAMIC_LABEL_ID); } diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/perspective/DocumentPerspective.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/perspective/DocumentPerspective.java index 422f13b2..5a8d845e 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/perspective/DocumentPerspective.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/perspective/DocumentPerspective.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 John Krasnay and others. + * Copyright (c) 2004, 2014 John Krasnay 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: * John Krasnay - initial API and implementation *******************************************************************************/ @@ -14,9 +14,6 @@ import org.eclipse.ui.IFolderLayout; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveFactory; -/** - * Implements the Document perspective. - */ public class DocumentPerspective implements IPerspectiveFactory { public void createInitialLayout(final IPageLayout layout) { @@ -24,31 +21,23 @@ public class DocumentPerspective implements IPerspectiveFactory { defineLayout(layout); } - /** - * Defines the initial actions for a page. - */ public void defineActions(final IPageLayout layout) { // Add "new wizards". layout.addNewWizardShortcut("org.eclipse.vex.ui.NewDocumentWizard");//$NON-NLS-1$ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$ - layout.addShowViewShortcut(IPageLayout.ID_RES_NAV); + layout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER); layout.addShowViewShortcut(IPageLayout.ID_OUTLINE); layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET); - - // layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET); } - /** - * Defines the initial layout for a page. - */ public void defineLayout(final IPageLayout layout) { final String editorArea = layout.getEditorArea(); final IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, (float) 0.2, editorArea);//$NON-NLS-1$ - topLeft.addView(IPageLayout.ID_RES_NAV); + topLeft.addView(IPageLayout.ID_PROJECT_EXPLORER); final IFolderLayout topRight = layout.createFolder("topRight", IPageLayout.RIGHT, (float) 0.75, editorArea);//$NON-NLS-1$ topRight.addView(IPageLayout.ID_OUTLINE); diff --git a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/wizards/NewDocumentWizard.java b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/wizards/NewDocumentWizard.java index a3efbfa9..ac3f8a98 100644 --- a/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/wizards/NewDocumentWizard.java +++ b/org.eclipse.vex.ui/src/org/eclipse/vex/ui/internal/wizards/NewDocumentWizard.java @@ -22,17 +22,11 @@ import org.eclipse.core.runtime.QualifiedName; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.internal.registry.EditorDescriptor; -import org.eclipse.ui.internal.registry.EditorRegistry; -import org.eclipse.ui.internal.registry.FileEditorMapping; import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; import org.eclipse.vex.core.internal.css.CssWhitespacePolicy; import org.eclipse.vex.core.internal.dom.Document; @@ -95,8 +89,6 @@ public class NewDocumentWizard extends Wizard implements INewWizard { final IFile file = filePage.createNewFile(); IDE.setDefaultEditor(file, VexEditor.ID); - registerEditorForFilename("*." + file.getFileExtension(), VexEditor.ID); //$NON-NLS-1$ - // Open editor on new file. final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { @@ -156,76 +148,4 @@ public class NewDocumentWizard extends Wizard implements INewWizard { return document; } - /* - * NOTE: this method uses internal, undocumented Eclipse functionality. It may therefore break in a future version - * of Eclipse. - */ - private static void registerEditorForFilename(final String fileName, final String editorId) { - - final EditorDescriptor ed = getEditorDescriptor(editorId); - if (ed == null) { - return; - } - - final IEditorRegistry reg = PlatformUI.getWorkbench().getEditorRegistry(); - final EditorRegistry ereg = (EditorRegistry) reg; - final FileEditorMapping[] mappings = (FileEditorMapping[]) ereg.getFileEditorMappings(); - FileEditorMapping mapping = null; - for (final FileEditorMapping fem : mappings) { - if (fem.getLabel().equals(fileName)) { - mapping = fem; - break; - } - } - - if (mapping != null) { - // found mapping for fileName - // make sure it includes our editor - for (final IEditorDescriptor editor : mapping.getEditors()) { - if (editor.getId().equals(editorId)) { - // already mapped - return; - } - } - - // editor not in the list, so add it - mapping.addEditor(ed); - ereg.setFileEditorMappings(mappings); - ereg.saveAssociations(); - - } else { - // no mapping found for the filename - // let's add one - String name = null; - String ext = null; - final int iDot = fileName.lastIndexOf('.'); - if (iDot == -1) { - name = fileName; - } else { - name = fileName.substring(0, iDot); - ext = fileName.substring(iDot + 1); - } - - mapping = new FileEditorMapping(name, ext); - final FileEditorMapping[] newMappings = new FileEditorMapping[mappings.length + 1]; - mapping.addEditor(ed); - - System.arraycopy(mappings, 0, newMappings, 0, mappings.length); - newMappings[mappings.length] = mapping; - ereg.setFileEditorMappings(newMappings); - ereg.saveAssociations(); - } - - } - - private static EditorDescriptor getEditorDescriptor(final String editorId) { - final EditorRegistry reg = (EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry(); - for (final IEditorDescriptor editor : reg.getSortedEditorsFromPlugins()) { - if (editor.getId().equals(editorId)) { - return (EditorDescriptor) editor; - } - } - - return null; - } } |