Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2020-06-14 13:37:56 +0000
committerLars Vogel2020-06-15 07:58:36 +0000
commit21f53331f85afe60c4679965d5617a1c720f2081 (patch)
tree5a69013605842949a7d4dba1507df2a43930c3ff
parent280091694a52452a56a0169971ff9eb409ee51ee (diff)
downloadeclipse.platform.ui-21f53331f85afe60c4679965d5617a1c720f2081.tar.gz
eclipse.platform.ui-21f53331f85afe60c4679965d5617a1c720f2081.tar.xz
eclipse.platform.ui-21f53331f85afe60c4679965d5617a1c720f2081.zip
Bug 564144 - Removes
org/eclipse/ui/internal/menus/WidgetProxy.java Full text search also showed no usage Change-Id: I89143e9128a8aa40efc4ee66dfa9e28bda592b05 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java209
1 files changed, 0 insertions, 209 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java
deleted file mode 100644
index d9d62b70a20..00000000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WidgetProxy.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.internal.menus;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.menus.AbstractWorkbenchTrimWidget;
-import org.eclipse.ui.menus.IWorkbenchWidget;
-
-/**
- * <p>
- * A proxy for a widget that has been defined in XML. This delays the class
- * loading until the widget is really asked to fill a menu collection. Asking
- * the widget for anything will instantiate the class.
- * </p>
- *
- * @since 3.2
- */
-final class WidgetProxy implements IWorkbenchWidget {
-
- /**
- * Used to determine whether the load has been tried to prevent multiple retries
- * at a failed load.
- */
- private boolean firstLoad = true;
-
- /**
- * The configuration element from which the widget can be created. This value
- * will exist until the element is converted into a real class -- at which point
- * this value will be set to <code>null</code>.
- */
- private IConfigurationElement configurationElement;
-
- /**
- * The real widget. This value is <code>null</code> until the proxy is forced to
- * load the real widget. At this point, the configuration element is converted,
- * nulled out, and this widget gains a reference.
- */
- private IWorkbenchWidget widget = null;
-
- /**
- * The name of the configuration element attribute which contains the
- * information necessary to instantiate the real widget.
- */
- private final String widgetAttributeName;
-
- /**
- * Constructs a new instance of <code>WidgetProxy</code> with all the
- * information it needs to try to load the class at a later point in time.
- *
- * @param configurationElement The configuration element from which the real
- * class can be loaded at run-time; must not be
- * <code>null</code>.
- * @param widgetAttributeName The name of the attibute or element containing
- * the widget executable extension; must not be
- * <code>null</code>.
- */
- public WidgetProxy(final IConfigurationElement configurationElement, final String widgetAttributeName) {
- if (configurationElement == null) {
- throw new NullPointerException("The configuration element backing a widget proxy cannot be null"); //$NON-NLS-1$
- }
-
- if (widgetAttributeName == null) {
- throw new NullPointerException("The attribute containing the widget class must be known"); //$NON-NLS-1$
- }
-
- this.configurationElement = configurationElement;
- this.widgetAttributeName = widgetAttributeName;
- }
-
- @Override
- public void dispose() {
- if (loadWidget()) {
- widget.dispose();
- }
- }
-
- @Override
- public void fill(final Composite parent) {
- if (loadWidget()) {
- widget.fill(parent);
- }
- }
-
- @Override
- public void fill(final CoolBar parent, final int index) {
- if (loadWidget()) {
- widget.fill(parent, index);
- }
- }
-
- @Override
- public void fill(final Menu parent, final int index) {
- if (loadWidget()) {
- widget.fill(parent, index);
- }
- }
-
- @Override
- public void fill(final ToolBar parent, final int index) {
- if (loadWidget()) {
- widget.fill(parent, index);
- }
- }
-
- @Override
- public void init(IWorkbenchWindow workbenchWindow) {
- if (loadWidget()) {
- widget.init(workbenchWindow);
- }
- }
-
- /**
- * Convenience method that allows the trim layout manager to inform widgets if
- * they have changed locations. If the IWidget implementation does not support
- * the method then we default to using the simpler
- * <code>fill(final Composite parent)</code>.
- *
- * @param parent The composite to create the controls in
- * @param oldSide The side the trim was previously displayed on
- * @param newSide The new side that the trim will be displayed on
- */
- public void fill(Composite parent, int oldSide, int newSide) {
- if (loadWidget()) {
- if (isMoveableTrimWidget()) {
- ((AbstractWorkbenchTrimWidget) widget).fill(parent, oldSide, newSide);
- } else {
- widget.fill(parent);
- }
- }
- }
-
- /**
- * Loads the widget, if possible. If the widget is loaded, then the member
- * variables are updated accordingly.
- *
- * @return <code>true</code> if the widget is now non-null; <code>false</code>
- * otherwise.
- */
- private boolean loadWidget() {
- if (firstLoad) {
- // Load the handler.
- try {
- widget = (IWorkbenchWidget) configurationElement.createExecutableExtension(widgetAttributeName);
- configurationElement = null;
- } catch (final ClassCastException e) {
- final String message = "The proxied widget was the wrong class"; //$NON-NLS-1$
- final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
- WorkbenchPlugin.log(message, status);
-
- } catch (final CoreException e) {
- final String message = "The proxied widget for '" //$NON-NLS-1$
- + configurationElement.getAttribute(widgetAttributeName) + "' could not be loaded"; //$NON-NLS-1$
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e);
- WorkbenchPlugin.log(message, status);
- }
- }
-
- // We're througth the first load
- firstLoad = false;
-
- // the load only succeeded if there's a widget..
- return widget != null;
- }
-
- /**
- * Determine if the widget knows how to respond to changes in the workbench
- * 'side' that it is being displayed on.
- *
- * @return <code>true</code> iff the <code>IWidget</code> implementation is
- * actually based on <code>AbstractTrimWidget</code>
- */
- private boolean isMoveableTrimWidget() {
- if (loadWidget()) {
- return widget instanceof AbstractWorkbenchTrimWidget;
- }
-
- return false;
- }
-
- @Override
- public String toString() {
- if (widget == null) {
- return configurationElement.getAttribute(widgetAttributeName);
- }
-
- return widget.toString();
- }
-}

Back to the top