[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-ui-dev] Deleting Code
|
While addressing another bug, it became apparent that some internal code in
the workbench is not being used. This also falls in line with previous
emails from John Arthorne.
I wish to apply the following patches. But, it would be helpful if Platform
UI committers could review these patches and make sure none of these classes
stand out. I don't want to delete something that has some secret
purpose ....
These patches delete about 30 classes.
cheers,
d.
Index: src/org/eclipse/ui/internal/ide/model/WorkbenchStatusList.java
===================================================================
RCS file: src/org/eclipse/ui/internal/ide/model/WorkbenchStatusList.java
diff -N src/org/eclipse/ui/internal/ide/model/WorkbenchStatusList.java
--- src/org/eclipse/ui/internal/ide/model/WorkbenchStatusList.java 25 Feb 2005 20:41:18 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.ide.model;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchAdapter;
-
-public class WorkbenchStatusList extends WorkbenchAdapter implements IAdaptable {
- private ArrayList statii = new ArrayList(10);
-
- public void add(IStatus status) {
- statii.add(new WorkbenchStatus(status));
- }
-
- public void clear() {
- statii.clear();
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- /**
- * Returns the children of this element.
- */
- public Object[] getChildren(Object o) {
- return statii.toArray();
- }
-
- public void remove(WorkbenchStatus status) {
- statii.remove(status);
- }
-}
Index: src/org/eclipse/ui/internal/wizards/datatransfer/Base64Encoder.java
===================================================================
RCS file: src/org/eclipse/ui/internal/wizards/datatransfer/Base64Encoder.java
diff -N src/org/eclipse/ui/internal/wizards/datatransfer/Base64Encoder.java
--- src/org/eclipse/ui/internal/wizards/datatransfer/Base64Encoder.java 25 Feb 2005 20:41:16 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.wizards.datatransfer;
-
-/**
- * This utility class converts a passed byte array into a Base 64 encoded
- * String according to the specification in RFC1521 section 5.2
- */
-public class Base64Encoder {
- private static final String mappings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//$NON-NLS-1$
-
- private static final String filler = "=";//$NON-NLS-1$
-
- /**
- * Answer a string representing the Base 64 encoded form of the passed
- * byte array
- *
- * @return java.lang.String
- * @param contents byte[]
- */
- public static String encode(byte[] contents) {
- StringBuffer result = new StringBuffer();
-
- for (int i = 0; i < contents.length; i = i + 3) {
- if (result.length() == 76)
- result.append("\n\r");//$NON-NLS-1$
-
- // output character 1
- result.append(mappings.charAt((contents[i] & 0xFC) >> 2));
-
- // output character 2
- int c2 = (contents[i] & 0x03) << 4;
- if (i + 1 >= contents.length) {
- result.append(mappings.charAt(c2));
- result.append(filler);
- result.append(filler);
- return result.toString();
- }
-
- c2 |= ((contents[i + 1] & 0xF0) >> 4);
- result.append(mappings.charAt(c2));
-
- // output character 3
- int c3 = (contents[i + 1] & 0x0F) << 2;
- if (i + 2 >= contents.length) {
- result.append(mappings.charAt(c3));
- result.append(filler);
- return result.toString();
- }
-
- c3 |= ((contents[i + 2] & 0xC0) >> 6);
- result.append(mappings.charAt(c3));
-
- // output character 4
- result.append(mappings.charAt(contents[i + 2] & 0x3F));
- }
-
- return result.toString();
- }
-}
Index: Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/KeywordTests.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/KeywordTests.java,v
retrieving revision 1.2
diff -u -r1.2 KeywordTests.java
--- Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/KeywordTests.java 25 Feb 2005 20:51:37 -0000 1.2
+++ Eclipse UI Tests/org/eclipse/ui/tests/dynamicplugins/KeywordTests.java 13 Apr 2005 18:29:38 -0000
@@ -11,7 +11,7 @@
package org.eclipse.ui.tests.dynamicplugins;
import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.keywords.KeywordRegistry;
+import org.eclipse.ui.internal.registry.KeywordRegistry;
/**
* @since 3.1
Index: Eclipse UI/org/eclipse/ui/internal/BooleanModel.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/BooleanModel.java
diff -N Eclipse UI/org/eclipse/ui/internal/BooleanModel.java
--- Eclipse UI/org/eclipse/ui/internal/BooleanModel.java 25 Feb 2005 20:52:13 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal;
-
-/**
- * Represents a boolean value that can be monitored for state changes.
- * The getState() method inherited from Model will always return a non-null
- * Boolean object.
- *
- * @since 3.0
- */
-public class BooleanModel extends Model {
-
- /**
- * Creates a new BooleanModel with the given initial state
- *
- * @param initialState initial value of the model
- */
- public BooleanModel(boolean initialState) {
- super(new Boolean(initialState));
- }
-
- /**
- * Sets the value and notifies all change listeners
- *
- * @param newValue new
- */
- public void set(boolean newValue) {
- set(newValue, null);
- }
-
- /**
- * Sets the value and notifies all change listeners except
- * the listener that caused the change.
- *
- * @param newValue new boolean value
- * @param origin change listener that caused the change, or null if
- * the change was not caused by a change listener.
- *
- */
- public void set(boolean newValue, IChangeListener origin) {
- super.setState(new Boolean(newValue), origin);
- }
-
- /**
- * Returns the current value as a boolean
- *
- * @return the current value
- */
- public boolean get() {
- return ((Boolean) getState()).booleanValue();
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/EditorView.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/EditorView.java
diff -N Eclipse UI/org/eclipse/ui/internal/EditorView.java
--- Eclipse UI/org/eclipse/ui/internal/EditorView.java 25 Feb 2005 20:52:12 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.part.ViewPart;
-
-public class EditorView extends ViewPart {
- private EditorList editorList;
-
- /**
- * Constructs a new editorList view.
- */
- public EditorView() {
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
- public void createPartControl(Composite parent) {
- IWorkbenchWindow window = getSite().getPage().getWorkbenchWindow();
- editorList = new EditorList(window, null);
- editorList.createControl(parent);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
- public void dispose() {
- editorList.dispose();
- editorList = null;
- super.dispose();
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- editorList.getControl().setFocus();
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/ICoolItemGroup.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/ICoolItemGroup.java
diff -N Eclipse UI/org/eclipse/ui/internal/ICoolItemGroup.java
--- Eclipse UI/org/eclipse/ui/internal/ICoolItemGroup.java 25 Feb 2005 20:52:13 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-public interface ICoolItemGroup {
- public String getContributingId(); // id of the action set that contributed the group
-
- public String getId(); // id of the contribution
-}
Index: Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
diff -N Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
--- Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java 25 Feb 2005 20:52:13 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.internal.decorators.DecoratorDefinition;
-
-/**
- * The LabelDecoratorAction is an action that toggles the
- * enabled state of a decorator.
- *
- * @since 2.0
- * @deprecated this action is no longer in use
- */
-public class LabelDecoratorAction extends Action {
-
- private DecoratorDefinition decorator;
-
- /**
- * Constructor for LabelDecoratorAction.
- * @param text
- */
- public LabelDecoratorAction(DecoratorDefinition definition) {
- super(definition.getName());
- decorator = definition;
- setChecked(decorator.isEnabled());
- }
-
- /*
- * see @Action.run()
- */
- public void run() {
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/Messages.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/Messages.java
diff -N Eclipse UI/org/eclipse/ui/internal/Messages.java
--- Eclipse UI/org/eclipse/ui/internal/Messages.java 25 Feb 2005 20:52:13 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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.ui.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @since 3.1
- */
-public class Messages {
- private static final String BUNDLE_NAME = "org.eclipse.ui.internal.messages";//$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- // TODO Auto-generated method stub
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
diff -N Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
--- Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java 25 Feb 2005 20:52:13 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * A dynamic contribution item which shows all opened perspectives
- * in the window's active page.
- */
-public class OpenedPerspectivesMenu extends ContributionItem {
- private IWorkbenchWindow window;
-
- private boolean showSeparator;
-
- private static final int MAX_TEXT_LENGTH = 40;
-
- /**
- * Create a new instance.
- */
- public OpenedPerspectivesMenu(IWorkbenchWindow window, String id,
- boolean showSeparator) {
- super(id);
- this.window = window;
- this.showSeparator = showSeparator;
- }
-
- /**
- * Returns the text for a perspective. This may be truncated to fit
- * within the MAX_TEXT_LENGTH.
- */
- private String calcText(int number, IPerspectiveDescriptor persp) {
- StringBuffer sb = new StringBuffer();
- if (number < 10)
- sb.append('&');
- sb.append(number);
- sb.append(' ');
- String suffix = persp.getLabel();
- if (suffix.length() <= MAX_TEXT_LENGTH) {
- sb.append(suffix);
- } else {
- sb.append(suffix.substring(0, MAX_TEXT_LENGTH / 2));
- sb.append("..."); //$NON-NLS-1$
- sb.append(suffix.substring(suffix.length() - MAX_TEXT_LENGTH / 2));
- }
- return sb.toString();
- }
-
- /**
- * Fills the given menu with menu items for all opened perspectives.
- */
- public void fill(Menu menu, int index) {
- final IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return;
-
- // Add separator.
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
-
- // Add one item for each opened perspective.
- IPerspectiveDescriptor activePersp = page.getPerspective();
- IPerspectiveDescriptor descriptors[] = page.getOpenPerspectives();
- int count = 1;
- for (int i = 0; i < descriptors.length; i++) {
- final IPerspectiveDescriptor desc = (IPerspectiveDescriptor) descriptors[i];
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
- mi.setSelection(desc == activePersp);
- mi.setText(calcText(count, desc));
- // avoid hanging onto page or perspective directly in menu
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- page.setPerspective(desc);
- }
- }
- });
-
- index++;
- count++;
- }
- }
-
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
diff -N Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
--- Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java 25 Feb 2005 20:52:12 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-class PartDropTarget {
- LayoutPart part;
-
- PartDropTarget(LayoutPart part) {
- this.part = part;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
diff -N Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
--- Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java 25 Feb 2005 20:52:11 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This is used to store the most recently used (MRU) list
- * of perspectives for the entire workbench.
- */
-public class PerspectiveHistory {
-
- private static final int DEFAULT_DEPTH = 50;
-
- private ArrayList shortcuts;
-
- private IPerspectiveRegistry reg;
-
- private ListenerList listeners = new ListenerList();
-
- public PerspectiveHistory(IPerspectiveRegistry reg) {
- this.shortcuts = new ArrayList(DEFAULT_DEPTH);
- this.reg = reg;
- }
-
- public void addListener(IPropertyListener l) {
- listeners.add(l);
- }
-
- public void removeListener(IPropertyListener l) {
- listeners.remove(l);
- }
-
- private void fireChange() {
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertyListener element = (IPropertyListener) array[i];
- element.propertyChanged(this, 0);
- }
- }
-
- public IStatus restoreState(IMemento memento) {
- IMemento[] children = memento.getChildren("desc"); //$NON-NLS-1$
- for (int i = 0; i < children.length && i < DEFAULT_DEPTH; i++) {
- IPerspectiveDescriptor desc = reg.findPerspectiveWithId(children[i]
- .getID());
- if (desc != null)
- shortcuts.add(desc);
- }
- return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- }
-
- public IStatus saveState(IMemento memento) {
- Iterator iter = shortcuts.iterator();
- while (iter.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) iter.next();
- memento.createChild("desc", desc.getId()); //$NON-NLS-1$
- }
- return new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
- }
-
- public void add(String id) {
- IPerspectiveDescriptor desc = reg.findPerspectiveWithId(id);
- if (desc != null)
- add(desc);
- }
-
- public void add(IPerspectiveDescriptor desc) {
- // Avoid duplicates
- if (shortcuts.contains(desc))
- return;
-
- // If the shortcut list will be too long, remove oldest ones
- int size = shortcuts.size();
- int preferredSize = DEFAULT_DEPTH;
- while (size >= preferredSize) {
- size--;
- shortcuts.remove(size);
- }
-
- // Insert at top as most recent
- shortcuts.add(0, desc);
- fireChange();
- }
-
- public void refreshFromRegistry() {
- boolean change = false;
-
- Iterator iter = shortcuts.iterator();
- while (iter.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) iter.next();
- if (reg.findPerspectiveWithId(desc.getId()) == null) {
- iter.remove();
- change = true;
- }
- }
-
- if (change)
- fireChange();
- }
-
- /**
- * Copy the requested number of items from the history into
- * the destination list at the given index.
- *
- * @param dest destination list to contain the items
- * @param destStart index in destination list to start copying items at
- * @param count number of items to copy from history
- * @return the number of items actually copied
- */
- public int copyItems(List dest, int destStart, int count) {
- int itemCount = count;
- if (itemCount > shortcuts.size())
- itemCount = shortcuts.size();
-
- for (int i = 0; i < itemCount; i++)
- dest.add(destStart + i, shortcuts.get(i));
-
- return itemCount;
- }
-
- //for dynamic UI
- public void removeItem(Object item) {
- for (int i = 0; i < shortcuts.size(); i++)
- if (shortcuts.get(i) == item) {
- shortcuts.remove(i);
- break;
- }
- }
-}
-
Index: Eclipse UI/org/eclipse/ui/internal/Workbench.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java,v
retrieving revision 1.322
diff -u -r1.322 Workbench.java
--- Eclipse UI/org/eclipse/ui/internal/Workbench.java 29 Mar 2005 01:02:52 -0000 1.322
+++ Eclipse UI/org/eclipse/ui/internal/Workbench.java 13 Apr 2005 18:29:47 -0000
@@ -98,9 +98,9 @@
import org.eclipse.ui.internal.activities.ws.WorkbenchActivitySupport;
import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
import org.eclipse.ui.internal.commands.CommandService;
-import org.eclipse.ui.internal.commands.ws.WorkbenchCommandSupport;
+import org.eclipse.ui.internal.commands.WorkbenchCommandSupport;
import org.eclipse.ui.internal.contexts.ContextService;
-import org.eclipse.ui.internal.contexts.ws.WorkbenchContextSupport;
+import org.eclipse.ui.internal.contexts.WorkbenchContextSupport;
import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
import org.eclipse.ui.internal.handlers.HandlerService;
import org.eclipse.ui.internal.help.WorkbenchHelpSystem;
Index: Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogErrorLogSection.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogErrorLogSection.java
diff -N Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogErrorLogSection.java
--- Eclipse UI/org/eclipse/ui/internal/about/ConfigurationLogErrorLogSection.java 25 Feb 2005 20:52:37 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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.ui.internal.about;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.Reader;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.about.ISystemSummarySection;
-
-/**
- * This class puts the content of the platform's error log into the system
- * summary dialog.
- *
- * @since 3.0
- */
-public class ConfigurationLogErrorLogSection implements ISystemSummarySection {
-
- /**
- * Appends the contents of the .log file
- *
- * @see org.eclipse.ui.about.ISystemSummarySection#write(java.io.PrintWriter)
- */
- public void write(PrintWriter writer) {
- File log = new File(Platform.getLogFileLocation().toOSString());
- if (log.exists()) {
- Reader reader = null;
- try {
- reader = new InputStreamReader(new FileInputStream(log),
- "UTF-8"); //$NON-NLS-1$
- char[] chars = new char[8192];
- while (true) {
- int read = reader.read(chars);
- if (read <= 0)
- break;
- writer.write(chars, 0, read);
- }
- } catch (IOException e) {
- writer.println("Error reading .log file"); //$NON-NLS-1$
- } finally {
- try {
- reader.close();
- } catch (IOException e) {
- // do nothing
- }
- }
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/commands/ws/WorkbenchCommandSupport.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/commands/ws/WorkbenchCommandSupport.java
diff -N Eclipse UI/org/eclipse/ui/internal/commands/ws/WorkbenchCommandSupport.java
--- Eclipse UI/org/eclipse/ui/internal/commands/ws/WorkbenchCommandSupport.java 22 Mar 2005 20:02:00 -0000 1.61
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 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.ui.internal.commands.ws;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.commands.CommandManager;
-import org.eclipse.core.commands.contexts.ContextManager;
-import org.eclipse.jface.bindings.BindingManager;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.LegacyHandlerSubmissionExpression;
-import org.eclipse.ui.commands.HandlerSubmission;
-import org.eclipse.ui.commands.ICommandManager;
-import org.eclipse.ui.commands.IWorkbenchCommandSupport;
-import org.eclipse.ui.commands.Priority;
-import org.eclipse.ui.handlers.IHandlerActivation;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.internal.commands.CommandManagerFactory;
-import org.eclipse.ui.internal.commands.CommandManagerWrapper;
-import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper;
-
-/**
- * Provides command support in terms of the workbench.
- *
- * @since 3.0
- */
-public class WorkbenchCommandSupport implements IWorkbenchCommandSupport {
-
- /**
- * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
- * indexed by the submissions (<code>HandlerSubmission</code>). This map
- * should be <code>null</code> if there are no such activations.
- */
- private Map activationsBySubmission = null;
-
- /**
- * The mutable command manager that should be notified of changes to the
- * list of active handlers. This value is never <code>null</code>.
- */
- private final CommandManagerWrapper commandManagerWrapper;
-
- /**
- * The handler service for the workbench. This value is never
- * <code>null</code>.
- */
- private final IHandlerService handlerService;
-
- /**
- * Constructs a new instance of <code>WorkbenchCommandSupport</code>
- *
- * @param bindingManager
- * The binding manager providing support for the command manager;
- * must not be <code>null</code>.
- * @param commandManager
- * The command manager for the workbench; must not be
- * <code>null</code>.
- * @param contextManager
- * The context manager providing support for the command manager
- * and binding manager; must not be <code>null</code>.
- * @param handlerService
- * The handler service for the workbench; must not be
- * <code>null</code>.
- */
- public WorkbenchCommandSupport(final BindingManager bindingManager,
- final CommandManager commandManager,
- final ContextManager contextManager,
- final IHandlerService handlerService) {
- if (handlerService == null) {
- throw new NullPointerException("The handler service cannot be null"); //$NON-NLS-1$
- }
-
- this.handlerService = handlerService;
-
- commandManagerWrapper = CommandManagerFactory.getCommandManagerWrapper(
- bindingManager, commandManager, contextManager);
-
- // Initialize the old key formatter settings.
- org.eclipse.ui.keys.KeyFormatterFactory
- .setDefault(org.eclipse.ui.keys.SWTKeySupport
- .getKeyFormatterForPlatform());
- }
-
- public final void addHandlerSubmission(
- final HandlerSubmission handlerSubmission) {
- /*
- * Create the source priorities based on the conditions mentioned in the
- * submission.
- */
- int sourcePriorities = 0;
- if (handlerSubmission.getActivePartId() != null) {
- sourcePriorities |= ISources.ACTIVE_PART;
- }
- if (handlerSubmission.getActiveShell() != null) {
- sourcePriorities |= (ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW);
- }
- if (handlerSubmission.getActiveWorkbenchPartSite() != null) {
- sourcePriorities |= ISources.ACTIVE_SITE;
- }
- if (handlerSubmission.getPriority() == Priority.LEGACY) {
- sourcePriorities |= ISources.LEGACY_LEGACY;
- } else if (handlerSubmission.getPriority() == Priority.LOW) {
- sourcePriorities |= ISources.LEGACY_LOW;
- } else if (handlerSubmission.getPriority() == Priority.MEDIUM) {
- sourcePriorities |= ISources.LEGACY_MEDIUM;
- }
-
- final IHandlerActivation activation = handlerService.activateHandler(
- handlerSubmission.getCommandId(), new LegacyHandlerWrapper(
- handlerSubmission.getHandler()),
- new LegacyHandlerSubmissionExpression(handlerSubmission
- .getActivePartId(), handlerSubmission.getActiveShell(),
- handlerSubmission.getActiveWorkbenchPartSite()),
- sourcePriorities);
- if (activationsBySubmission == null) {
- activationsBySubmission = new HashMap();
- }
- activationsBySubmission.put(handlerSubmission, activation);
- }
-
- public final void addHandlerSubmissions(final Collection handlerSubmissions) {
- final Iterator submissionItr = handlerSubmissions.iterator();
- while (submissionItr.hasNext()) {
- addHandlerSubmission((HandlerSubmission) submissionItr.next());
- }
- }
-
- public ICommandManager getCommandManager() {
- return commandManagerWrapper;
- }
-
- public final void removeHandlerSubmission(
- final HandlerSubmission handlerSubmission) {
- if (activationsBySubmission == null) {
- return;
- }
-
- final Object value = activationsBySubmission.remove(handlerSubmission);
- if (value instanceof IHandlerActivation) {
- final IHandlerActivation activation = (IHandlerActivation) value;
- handlerService.deactivateHandler(activation);
- }
- }
-
- public final void removeHandlerSubmissions(
- final Collection handlerSubmissions) {
- final Iterator submissionItr = handlerSubmissions.iterator();
- while (submissionItr.hasNext()) {
- removeHandlerSubmission((HandlerSubmission) submissionItr.next());
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/contexts/ws/WorkbenchContextSupport.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/contexts/ws/WorkbenchContextSupport.java
diff -N Eclipse UI/org/eclipse/ui/internal/contexts/ws/WorkbenchContextSupport.java
--- Eclipse UI/org/eclipse/ui/internal/contexts/ws/WorkbenchContextSupport.java 22 Mar 2005 21:04:50 -0000 1.51
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 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.ui.internal.contexts.ws;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.commands.contexts.ContextManager;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.LegacyHandlerSubmissionExpression;
-import org.eclipse.ui.contexts.EnabledSubmission;
-import org.eclipse.ui.contexts.IContextActivation;
-import org.eclipse.ui.contexts.IContextManager;
-import org.eclipse.ui.contexts.IContextService;
-import org.eclipse.ui.contexts.IWorkbenchContextSupport;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.contexts.ContextManagerFactory;
-import org.eclipse.ui.internal.contexts.ContextManagerWrapper;
-import org.eclipse.ui.keys.IBindingService;
-
-/**
- * Provides support for contexts within the workbench -- including key bindings,
- * and some default contexts for shell types.
- *
- * @since 3.0
- */
-public class WorkbenchContextSupport implements IWorkbenchContextSupport {
-
- /**
- * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
- * indexed by the submissions (<code>HandlerSubmission</code>). This map
- * should be <code>null</code> if there are no such activations.
- */
- private Map activationsBySubmission = null;
-
- /**
- * The binding service for the workbench. This value is never
- * <code>null</code>.
- */
- private IBindingService bindingService;
-
- /**
- * The context service for the workbench. This value is never
- * <code>null</code>.
- */
- private IContextService contextService;
-
- /**
- * The legacy context manager supported by this application.
- */
- private ContextManagerWrapper contextManagerWrapper;
-
- /**
- * The workbench for which context support is being provided. This value
- * must not be <code>null</code>.
- */
- private final Workbench workbench;
-
- /**
- * Constructs a new instance of <code>WorkbenchCommandSupport</code>.
- * This attaches the key binding support, and adds a global shell activation
- * filter.
- *
- * @param workbenchToSupport
- * The workbench that needs to be supported by this instance;
- * must not be <code>null</code>.
- * @param contextManager
- * The context manager to be wrappered; must not be
- * <code>null</code>.
- */
- public WorkbenchContextSupport(final Workbench workbenchToSupport,
- final ContextManager contextManager) {
- workbench = workbenchToSupport;
- contextService = (IContextService) workbench
- .getAdapter(IContextService.class);
- bindingService = (IBindingService) workbench
- .getAdapter(IBindingService.class);
- contextManagerWrapper = ContextManagerFactory
- .getContextManagerWrapper(contextManager);
- }
-
- public final void addEnabledSubmission(
- final EnabledSubmission enabledSubmission) {
- /*
- * Create the source priorities based on the conditions mentioned in the
- * submission.
- */
- int sourcePriorities = 0;
- if (enabledSubmission.getActivePartId() != null) {
- sourcePriorities |= ISources.ACTIVE_PART;
- }
- if (enabledSubmission.getActiveShell() != null) {
- sourcePriorities |= (ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW);
- }
- if (enabledSubmission.getActiveWorkbenchPartSite() != null) {
- sourcePriorities |= ISources.ACTIVE_SITE;
- }
-
- final IContextActivation activation = contextService.activateContext(
- enabledSubmission.getContextId(),
- new LegacyHandlerSubmissionExpression(enabledSubmission
- .getActivePartId(), enabledSubmission.getActiveShell(),
- enabledSubmission.getActiveWorkbenchPartSite()),
- sourcePriorities);
- if (activationsBySubmission == null) {
- activationsBySubmission = new HashMap();
- }
- activationsBySubmission.put(enabledSubmission, activation);
- }
-
- public final void addEnabledSubmissions(final Collection enabledSubmissions) {
- final Iterator submissionItr = enabledSubmissions.iterator();
- while (submissionItr.hasNext()) {
- addEnabledSubmission((EnabledSubmission) submissionItr.next());
- }
- }
-
- public final IContextManager getContextManager() {
- return contextManagerWrapper;
- }
-
- public final int getShellType(Shell shell) {
- return contextService.getShellType(shell);
- }
-
- public final boolean isKeyFilterEnabled() {
- return bindingService.isKeyFilterEnabled();
- }
-
- public final void openKeyAssistDialog() {
- bindingService.openKeyAssistDialog();
- }
-
- public final boolean registerShell(final Shell shell, final int type) {
- return contextService.registerShell(shell, type);
- }
-
- public final void removeEnabledSubmission(
- final EnabledSubmission enabledSubmission) {
- if (activationsBySubmission == null) {
- return;
- }
-
- final Object value = activationsBySubmission.remove(enabledSubmission);
- if (value instanceof IContextActivation) {
- final IContextActivation activation = (IContextActivation) value;
- contextService.deactivateContext(activation);
- }
- }
-
- public final void removeEnabledSubmissions(
- final Collection enabledSubmissions) {
- final Iterator submissionItr = enabledSubmissions.iterator();
- while (submissionItr.hasNext()) {
- removeEnabledSubmission((EnabledSubmission) submissionItr.next());
- }
- }
-
- public final void setKeyFilterEnabled(final boolean enabled) {
- bindingService.setKeyFilterEnabled(enabled);
- }
-
- public final boolean unregisterShell(final Shell shell) {
- return contextService.unregisterShell(shell);
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/dialogs/ColorThemeDemo.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/dialogs/ColorThemeDemo.java
diff -N Eclipse UI/org/eclipse/ui/internal/dialogs/ColorThemeDemo.java
--- Eclipse UI/org/eclipse/ui/internal/dialogs/ColorThemeDemo.java 25 Feb 2005 20:52:32 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.dialogs;
-
-/**
- * Class to encapsulate the set of widgets that will be used to indicate
- * the current color theme of the workbench and give feedback on
- * changes made.
- */
-public class ColorThemeDemo {
-
- // Composite sampleComposite;
- // CTabFolder sampleTabFolder;
- //
- // /**
- // * Creates an instance of the <code>ColorThemeDemo</code> class.
- // *
- // * @param Composite parent The parent containing the ColorThemeDemo widgets
- // */
- // public ColorThemeDemo(Composite parent) {
- // createControl(parent);
- // }
- //
- // /**
- // * Create the set of widgets to display in the receiver.
- // *
- // * @param Composite parent The parent containing the ColorThemeDemo widgets
- // */
- // private void createControl(Composite parent) {
- // Composite marginComposite = new Composite(parent, SWT.NONE);
- // GridLayout gl = new GridLayout();
- // gl.marginHeight = 1;
- // gl.marginWidth = 1;
- //
- // marginComposite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK));
- // marginComposite.setLayout(gl);
- // GridData gd = new GridData();
- // gd.horizontalSpan = 2;
- // marginComposite.setLayoutData(gd);
- //
- // sampleComposite = new Composite(marginComposite, SWT.H_SCROLL | SWT.V_SCROLL);
- // sampleComposite.setLayout(new GridLayout());
- // GridData gridData = new GridData(GridData.FILL_BOTH);
- // sampleComposite.setData(gridData);
- //
- // sampleTabFolder = new CTabFolder(sampleComposite, SWT.BORDER);
- // sampleTabFolder.setSimpleTab(WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS));
- // sampleTabFolder.setData(new GridData(GridData.FILL_BOTH));
- // CTabItem temp = new CTabItem(sampleTabFolder, SWT.NONE);
- // temp.setText("Console");
- // Text text = new Text(sampleTabFolder, SWT.MULTI);
- // text.setText("Lorem ipsum dolor sit amet\n"); //$NON-NLS-1$
- // temp.setControl(text);
- // sampleTabFolder.setSelection(0);
- // temp = new CTabItem(sampleTabFolder, SWT.NONE);
- // temp.setText("Search");
- //
- // resetColors();
- // }
- //
- // /**
- // * Reset the colors in the receiver.
- // */
- // public void resetColors() {
- // ColorSchemeService.setTabColors(sampleTabFolder);
- // }
- //
- // /**
- // * Redraw the receiver.
- // */
- // void redraw() {
- // sampleTabFolder.redraw();
- // }
- //
- // /**
- // * Set the Selected Tab background
- // * @param color
- // */
- // public void setTabSelectionBGColor(Color color) {
- // sampleTabFolder.setSelectionBackground(WorkbenchColors.createGradientArray(sampleTabFolder.getDisplay(), color), WorkbenchColors.getActiveViewGradientPercents(), true);
- // }
- //
- // /**
- // * Set the Selected Tab foreground
- // * @param color
- // */
- // public void setTabSelectionFGColor(Color color) {
- // sampleTabFolder.setSelectionForeground(color);
- // }
- //
- // /**
- // * Set the Tab background
- // * @param color
- // */
- // public void setTabBGColor(Color color) {
- // sampleTabFolder.setBackground(WorkbenchColors.createGradientArray(sampleTabFolder.getDisplay(), color), WorkbenchColors.getActiveViewGradientPercents(), true);
- // }
- //
- // /**
- // * Set the Selected Tab foreground
- // * @param color
- // */
- // public void setTabFGColor(Color color) {
- // sampleTabFolder.setForeground(color);
- // }
- //
- //
-}
Index: Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesContentProvider.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesContentProvider.java
diff -N Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesContentProvider.java
--- Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesContentProvider.java 25 Feb 2005 20:52:32 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.dialogs;
-
-import java.util.*;
-import org.eclipse.core.runtime.preferences.*;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.osgi.service.prefs.BackingStoreException;
-import org.osgi.service.prefs.Preferences;
-
-/**
- * The PreferencesContentProvider is the content provider for the
- * preferences export tree.
- */
-public class PreferencesContentProvider implements ITreeContentProvider {
-
- private static Set scopes = new HashSet();
-
- static {
- scopes.add(InstanceScope.SCOPE);
- scopes.add(ConfigurationScope.SCOPE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer v, Object oldInput, Object newInput) {
- // do nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object parent) {
- Object[] children = getChildren(parent);
- IEclipsePreferences[] preferences = new IEclipsePreferences[children.length];
- System.arraycopy(children, 0, preferences, 0, children.length);
- return preferences;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object child) {
- if (child instanceof IEclipsePreferences)
- return ((IEclipsePreferences) child).parent();
- return null;
- }
-
- private boolean hasKeys(Preferences node) throws BackingStoreException {
- if (node.keys().length > 0)
- return true;
- String[] children = node.childrenNames();
- for (int i = 0; i < children.length; i++) {
- String child = children[i];
- if (hasKeys(node.node(child)))
- return true;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parent) {
- ArrayList result = new ArrayList();
- if (parent instanceof IEclipsePreferences) {
- IEclipsePreferences node = (IEclipsePreferences) parent;
-
- try {
- if (node.parent() == null) {
- // handle the case where we are given the root of the tree
- String[] childrenNames = node.childrenNames();
- for (int i = 0; childrenNames != null && i < childrenNames.length; i++) {
- String child = childrenNames[i];
- if (!scopes.contains(child))
- continue;
- Preferences preferences = node.node(child);
- if (hasKeys(preferences))
- result.add(preferences);
- }
- } else if (node.parent().parent() == null) {
- // if we are on a second level
- String[] childrenNames = node.childrenNames();
- for (int i = 0; childrenNames != null && i < childrenNames.length; i++) {
- String child = childrenNames[i];
- Preferences preferences = node.node(child);
- if (hasKeys(preferences))
- result.add(preferences);
- }
- }
-
- } catch (BackingStoreException e) {
- e.printStackTrace();
- }
- }
- return result.toArray(new Object[result.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object parent) {
- IEclipsePreferences node = (IEclipsePreferences) parent;
- try {
- if (node.parent() == null && hasKeys(node))
- return true;
- if (node.parent().parent() == null && hasKeys(node))
- return true;
- } catch (BackingStoreException e) {
- // do nothing
- }
- return false;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/keys/GnomeKeyFormatter.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/keys/GnomeKeyFormatter.java
diff -N Eclipse UI/org/eclipse/ui/internal/keys/GnomeKeyFormatter.java
--- Eclipse UI/org/eclipse/ui/internal/keys/GnomeKeyFormatter.java 25 Feb 2005 20:52:20 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.keys;
-
-import java.util.Comparator;
-import java.util.ResourceBundle;
-
-import org.eclipse.ui.internal.util.Util;
-import org.eclipse.ui.keys.KeySequence;
-import org.eclipse.ui.keys.KeyStroke;
-import org.eclipse.ui.keys.ModifierKey;
-
-public final class GnomeKeyFormatter extends AbstractKeyFormatter {
-
- private final static class GnomeModifierKeyComparator extends
- AbstractModifierKeyComparator {
-
- protected int rank(ModifierKey modifierKey) {
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 2;
- }
-
- return Integer.MAX_VALUE;
- }
- }
-
- private final static Comparator MODIFIER_KEY_COMPARATOR = new GnomeModifierKeyComparator();
-
- private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(GnomeKeyFormatter.class.getName());
-
- protected String getKeyDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
- KeyStroke.KEY_DELIMITER, false, false);
- }
-
- protected String getKeyStrokeDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
-
- protected Comparator getModifierKeyComparator() {
- return MODIFIER_KEY_COMPARATOR;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/keys/WindowsKeyFormatter.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/keys/WindowsKeyFormatter.java
diff -N Eclipse UI/org/eclipse/ui/internal/keys/WindowsKeyFormatter.java
--- Eclipse UI/org/eclipse/ui/internal/keys/WindowsKeyFormatter.java 25 Feb 2005 20:52:20 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.keys;
-
-import java.util.Comparator;
-import java.util.ResourceBundle;
-
-import org.eclipse.ui.internal.util.Util;
-import org.eclipse.ui.keys.KeySequence;
-import org.eclipse.ui.keys.KeyStroke;
-import org.eclipse.ui.keys.ModifierKey;
-
-public final class WindowsKeyFormatter extends AbstractKeyFormatter {
-
- private final static class WindowsModifierKeyComparator extends
- AbstractModifierKeyComparator {
-
- protected int rank(ModifierKey modifierKey) {
- if (ModifierKey.CTRL.equals(modifierKey)) {
- return 0;
- }
-
- if (ModifierKey.ALT.equals(modifierKey)) {
- return 1;
- }
-
- if (ModifierKey.SHIFT.equals(modifierKey)) {
- return 2;
- }
-
- return Integer.MAX_VALUE;
- }
- }
-
- private final static Comparator MODIFIER_KEY_COMPARATOR = new WindowsModifierKeyComparator();
-
- private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(WindowsKeyFormatter.class.getName());
-
- protected String getKeyDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
- KeyStroke.KEY_DELIMITER, false, false);
- }
-
- protected String getKeyStrokeDelimiter() {
- return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY,
- KeySequence.KEY_STROKE_DELIMITER, false, false);
- }
-
- protected Comparator getModifierKeyComparator() {
- return MODIFIER_KEY_COMPARATOR;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/keywords/KeywordRegistry.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/keywords/KeywordRegistry.java
diff -N Eclipse UI/org/eclipse/ui/internal/keywords/KeywordRegistry.java
--- Eclipse UI/org/eclipse/ui/internal/keywords/KeywordRegistry.java 28 Mar 2005 21:26:56 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 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.ui.internal.keywords;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
-import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
-import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-
-/**
- * Contains extensions defined on the <code>keywords</code> extension point.
- *
- * @since 3.1
- */
-public final class KeywordRegistry implements IExtensionChangeHandler {
-
- private static final String ATT_ID = "id"; //$NON-NLS-1$
-
- private static final String ATT_LABEL = "label"; //$NON-NLS-1$
-
- private static KeywordRegistry instance;
-
- private static final String TAG_KEYWORD = "keyword"; //$NON-NLS-1$
-
- /**
- * Return the singleton instance of the <code>KeywordRegistry</code>.
- *
- * @return the singleton registry
- */
- public static KeywordRegistry getInstance() {
- if (instance == null) {
- instance = new KeywordRegistry();
- }
-
- return instance;
- }
-
- /**
- * Map of id->labels.
- */
- private Map internalKeywordMap = new HashMap();
-
- /**
- * Private constructor.
- */
- private KeywordRegistry() {
- IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
- tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
- IExtension[] extensions = getExtensionPointFilter().getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- addExtension(PlatformUI.getWorkbench().getExtensionTracker(),
- extensions[i]);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.dynamicHelpers.IExtensionChangeHandler#addExtension(org.eclipse.core.runtime.dynamicHelpers.IExtensionTracker, org.eclipse.core.runtime.IExtension)
- */
- public void addExtension(IExtensionTracker tracker, IExtension extension) {
- IConfigurationElement[] elements = extension.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i].getName().equals(TAG_KEYWORD)) {
- String name = elements[i].getAttribute(ATT_LABEL);
- String id = elements[i].getAttribute(ATT_ID);
- internalKeywordMap.put(id, name);
- PlatformUI.getWorkbench().getExtensionTracker().registerObject(
- extension, id, IExtensionTracker.REF_WEAK);
- }
- }
- }
-
- private IExtensionPoint getExtensionPointFilter() {
- return Platform.getExtensionRegistry().getExtensionPoint(
- PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_KEYWORDS);
- }
-
- /**
- * Return the label associated with the given keyword.
- *
- * @param id the keyword id
- * @return the label or <code>null</code>
- */
- public String getKeywordLabel(String id) {
- return (String) internalKeywordMap.get(id);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.dynamicHelpers.IExtensionChangeHandler#removeExtension(org.eclipse.core.runtime.IExtension, java.lang.Object[])
- */
- public void removeExtension(IExtension extension, Object[] objects) {
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof String) {
- internalKeywordMap.remove(objects[i]);
- }
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/preferences/DelegatingPropertyMap.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/DelegatingPropertyMap.java
diff -N Eclipse UI/org/eclipse/ui/internal/preferences/DelegatingPropertyMap.java
--- Eclipse UI/org/eclipse/ui/internal/preferences/DelegatingPropertyMap.java 25 Feb 2005 20:52:22 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.preferences;
-
-import java.util.Set;
-
-/**
- * Creates a wrapper around another given map. All methods delegate to the given
- * map, however this object maintains its own localized listener list. This can
- * be used to protect global property maps from listener leaks. For example, assume
- * that some client object needs access to some global property map. Instead of
- * giving the client object direct access to the global map, wrap the global map
- * in a DelegatingPropertyMap and give the client code access to the wrapper instead.
- * When it comes time to destroy the client object, dispose the wrapper. This will
- * remove all listeners which may have been attached by the client code.
- *
- * @since 3.1
- */
-public class DelegatingPropertyMap extends PropertyMapAdapter {
-
- private IDynamicPropertyMap realMap;
-
- private IPropertyMapListener listener = new IPropertyMapListener() {
- public void propertyChanged(String[] preferenceIds) {
- firePropertyChange(preferenceIds);
- }
-
- public void listenerAttached() {
- }
- };
-
- public DelegatingPropertyMap(IDynamicPropertyMap originalMap) {
- this.realMap = originalMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.PropertyMapAdapter#attachListener()
- */
- protected void attachListener() {
- realMap.addListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.PropertyMapAdapter#detachListener()
- */
- protected void detachListener() {
- realMap.removeListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#keySet()
- */
- public Set keySet() {
- return realMap.keySet();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#getValue(java.lang.String, java.lang.Class)
- */
- public Object getValue(String propertyId, Class propertyType) {
- return realMap.getValue(propertyId, propertyType);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#propertyExists(java.lang.String)
- */
- public boolean propertyExists(String propertyId) {
- return realMap.propertyExists(propertyId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#setValue(java.lang.String, java.lang.Object)
- */
- public void setValue(String propertyId, Object newValue) {
- realMap.setValue(propertyId, newValue);
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreDefaultAdapter.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreDefaultAdapter.java
diff -N Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreDefaultAdapter.java
--- Eclipse UI/org/eclipse/ui/internal/preferences/PreferenceStoreDefaultAdapter.java 25 Feb 2005 20:52:22 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.preferences;
-
-import java.util.Set;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-
-/**
- * @since 3.1
- */
-public final class PreferenceStoreDefaultAdapter implements IPropertyMap {
-
- private IPreferenceStore store;
-
- public PreferenceStoreDefaultAdapter(IPreferenceStore toConvert) {
- this.store = toConvert;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#getValue(java.lang.String, java.lang.Class)
- */
- public Object getValue(String propertyId, Class propertyType) {
- if (propertyType.isAssignableFrom(String.class)) {
- return store.getDefaultString(propertyId);
- }
-
- if (propertyType == Boolean.class) {
- return new Boolean(store.getDefaultBoolean(propertyId));
- }
-
- if (propertyType == Double.class) {
- return new Double(store.getDefaultDouble(propertyId));
- }
-
- if (propertyType == Float.class) {
- return new Float(store.getDefaultFloat(propertyId));
- }
-
- if (propertyType == Integer.class) {
- return new Integer(store.getDefaultInt(propertyId));
- }
-
- if (propertyType == Long.class) {
- return new Long(store.getDefaultLong(propertyId));
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#isCommonProperty(java.lang.String)
- */
- public boolean isCommonProperty(String propertyId) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#keySet()
- */
- public Set keySet() {
- throw new UnsupportedOperationException();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#propertyExists(java.lang.String)
- */
- public boolean propertyExists(String propertyId) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#setValue(java.lang.String, java.lang.Object)
- */
- public void setValue(String propertyId, Object newValue) {
- if (newValue instanceof String) {
- store.setDefault(propertyId, (String)newValue);
- } else if (newValue instanceof Integer) {
- store.setDefault(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Boolean) {
- store.setDefault(propertyId, ((Boolean)newValue).booleanValue());
- } else if (newValue instanceof Double) {
- store.setDefault(propertyId, ((Double)newValue).doubleValue());
- } else if (newValue instanceof Float) {
- store.setDefault(propertyId, ((Float)newValue).floatValue());
- } else if (newValue instanceof Integer) {
- store.setDefault(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Long) {
- store.setDefault(propertyId, ((Long)newValue).longValue());
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesDefaultAdapter.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesDefaultAdapter.java
diff -N Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesDefaultAdapter.java
--- Eclipse UI/org/eclipse/ui/internal/preferences/PreferencesDefaultAdapter.java 25 Feb 2005 20:52:22 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.preferences;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Preferences;
-
-/**
- * @since 3.1
- */
-public final class PreferencesDefaultAdapter implements IPropertyMap {
-
- private Preferences store;
-
- public PreferencesDefaultAdapter(Preferences toConvert) {
- this.store = toConvert;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#getValue(java.lang.String, java.lang.Class)
- */
- public Object getValue(String propertyId, Class propertyType) {
- if (propertyType.isAssignableFrom(String.class)) {
- return store.getDefaultString(propertyId);
- }
-
- if (propertyType == Boolean.class) {
- return new Boolean(store.getDefaultBoolean(propertyId));
- }
-
- if (propertyType == Double.class) {
- return new Double(store.getDefaultDouble(propertyId));
- }
-
- if (propertyType == Float.class) {
- return new Float(store.getDefaultFloat(propertyId));
- }
-
- if (propertyType == Integer.class) {
- return new Integer(store.getDefaultInt(propertyId));
- }
-
- if (propertyType == Long.class) {
- return new Long(store.getDefaultLong(propertyId));
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#isCommonProperty(java.lang.String)
- */
- public boolean isCommonProperty(String propertyId) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#keySet()
- */
- public Set keySet() {
- Set result = new HashSet();
-
- String[] names = store.propertyNames();
-
- for (int i = 0; i < names.length; i++) {
- String string = names[i];
-
- result.add(string);
- }
-
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#propertyExists(java.lang.String)
- */
- public boolean propertyExists(String propertyId) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#setValue(java.lang.String, java.lang.Object)
- */
- public void setValue(String propertyId, Object newValue) {
- if (newValue instanceof String) {
- store.setDefault(propertyId, (String)newValue);
- } else if (newValue instanceof Integer) {
- store.setDefault(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Boolean) {
- store.setDefault(propertyId, ((Boolean)newValue).booleanValue());
- } else if (newValue instanceof Double) {
- store.setDefault(propertyId, ((Double)newValue).doubleValue());
- } else if (newValue instanceof Float) {
- store.setDefault(propertyId, ((Float)newValue).floatValue());
- } else if (newValue instanceof Integer) {
- store.setDefault(propertyId, ((Integer)newValue).intValue());
- } else if (newValue instanceof Long) {
- store.setDefault(propertyId, ((Long)newValue).longValue());
- }
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMap.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMap.java
diff -N Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMap.java
--- Eclipse UI/org/eclipse/ui/internal/preferences/PropertyMap.java 25 Feb 2005 20:52:22 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.preferences;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @since 3.1
- */
-public final class PropertyMap implements IPropertyMap {
-
- private Map map;
-
- public PropertyMap() {
- this(new HashMap());
- }
-
- public PropertyMap(Map underlyingMap) {
- map = underlyingMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#keySet()
- */
- public Set keySet() {
- return map.keySet();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#getValue(java.lang.String, java.lang.Class)
- */
- public Object getValue(String propertyId, Class propertyType) {
- Object result = map.get(propertyId);
-
- if (propertyType.isInstance(result)) {
- return result;
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#isCommonProperty(java.lang.String)
- */
- public boolean isCommonProperty(String propertyId) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#propertyExists(java.lang.String)
- */
- public boolean propertyExists(String propertyId) {
- return map.containsKey(propertyId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.IPropertyMap#setValue(java.lang.String, java.lang.Object)
- */
- public void setValue(String propertyId, Object newValue) {
- map.put(propertyId, newValue);
- }
-
- public void removeValue(String propertyId) {
- map.remove(propertyId);
- }
-
- public boolean equals(Object toCompare) {
- return toCompare instanceof IPropertyMap && PropertyUtil.isEqual(this, (IPropertyMap)toCompare);
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java,v
retrieving revision 1.5
diff -u -r1.5 WorkbenchPreferenceExtensionNode.java
--- Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java 18 Mar 2005 14:05:26 -0000 1.5
+++ Eclipse UI/org/eclipse/ui/internal/preferences/WorkbenchPreferenceExtensionNode.java 13 Apr 2005 18:29:48 -0000
@@ -22,8 +22,8 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IPluginContribution;
-import org.eclipse.ui.internal.keywords.KeywordRegistry;
import org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants;
+import org.eclipse.ui.internal.registry.KeywordRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
Index: Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultPropertyListener.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultPropertyListener.java
diff -N Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultPropertyListener.java
--- Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/DefaultPropertyListener.java 25 Feb 2005 20:52:32 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.presentations.defaultpresentation;
-
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.internal.preferences.AbstractPropertyListener;
-import org.eclipse.ui.internal.preferences.IDynamicPropertyMap;
-import org.eclipse.ui.internal.preferences.PropertyUtil;
-
-/**
- * @since 3.1
- */
-public class DefaultPropertyListener extends AbstractPropertyListener {
-
- public DefaultTabFolder tabFolder;
- public IDynamicPropertyMap preferences;
-
- public DefaultPropertyListener(DefaultTabFolder folder, IDynamicPropertyMap prefs) {
- this.tabFolder = folder;
- this.preferences = prefs;
-
- prefs.addListener(new String[]{IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS}, this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.AbstractPropertyListener#update()
- */
- public void update() {
- tabFolder.setSimpleTabs(PropertyUtil.get(preferences,
- IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, true));
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/TabPositionListener.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/TabPositionListener.java
diff -N Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/TabPositionListener.java
--- Eclipse UI/org/eclipse/ui/internal/presentations/defaultpresentation/TabPositionListener.java 25 Feb 2005 20:52:32 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.presentations.defaultpresentation;
-
-import org.eclipse.ui.internal.preferences.AbstractPropertyListener;
-
-/**
- * @since 3.1
- */
-public class TabPositionListener extends AbstractPropertyListener {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.preferences.AbstractPropertyListener#update()
- */
- public void update() {
-
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/presentations/newapi/ITabPositionListener.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/presentations/newapi/ITabPositionListener.java
diff -N Eclipse UI/org/eclipse/ui/internal/presentations/newapi/ITabPositionListener.java
--- Eclipse UI/org/eclipse/ui/internal/presentations/newapi/ITabPositionListener.java 25 Feb 2005 20:52:27 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 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.ui.internal.presentations.newapi;
-
-/**
- * @since 3.1
- */
-public interface ITabPositionListener {
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/progress/AwaitingFeedbackInfo.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/progress/AwaitingFeedbackInfo.java
diff -N Eclipse UI/org/eclipse/ui/internal/progress/AwaitingFeedbackInfo.java
--- Eclipse UI/org/eclipse/ui/internal/progress/AwaitingFeedbackInfo.java 25 Feb 2005 20:52:21 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.progress;
-
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * An AwaitingFeedbackInfo is a simple structure for keeping
- * track of a message and UIJob to run.
- */
-public class AwaitingFeedbackInfo {
-
- private String message;
-
- private UIJob job;
-
- public AwaitingFeedbackInfo(String infoMessage, UIJob infoJob) {
- this.message = infoMessage;
- this.job = infoJob;
- }
-
- /**
- * Return the job for the receiver.
- * @return
- */
- public UIJob getJob() {
- return this.job;
- }
-
- /**
- * Return the message for the receiver.
- * @return
- */
- public String getMessage() {
- return this.message;
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/progress/FullProgressViewer.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/progress/FullProgressViewer.java
diff -N Eclipse UI/org/eclipse/ui/internal/progress/FullProgressViewer.java
--- Eclipse UI/org/eclipse/ui/internal/progress/FullProgressViewer.java 25 Feb 2005 20:52:21 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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.ui.internal.progress;
-
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * The FullProgressViewer is the viewer that displays jobs with full progress.
- *
- */
-public class FullProgressViewer extends AbstractProgressViewer {
-
- Composite control;
-
- /**
- * Creates a table viewer on a newly-created table control under the given
- * parent. The table control is created using the given style bits. The
- * viewer has no input, no content provider, a default label provider, no
- * sorter, and no filters. The table has no columns.
- *
- * @param parent
- * the parent control
- * @param style
- * SWT style bits
- */
- public FullProgressViewer(Composite parent, int style) {
- control = new Composite(parent, style);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.StructuredViewer#doFindInputItem(java.lang.Object)
- */
- protected Widget doFindInputItem(Object element) {
- if (element == ProgressManager.getInstance())
- return control;
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.StructuredViewer#doFindItem(java.lang.Object)
- */
- protected Widget doFindItem(Object element) {
- Control[] children = control.getChildren();
- for (int i = 0; i < children.length; i++) {
- ProgressItem control = (ProgressItem) children[i];
- if(control.getElement().equals(element))
- return control;
- }
- return null;
- }
-
- protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
- // TODO Auto-generated method stub
-
- }
-
- protected List getSelectionFromWidget() {
- // TODO Auto-generated method stub
- return null;
- }
-
- protected void internalRefresh(Object element) {
- // TODO Auto-generated method stub
-
- }
-
- public void reveal(Object element) {
- // TODO Auto-generated method stub
-
- }
-
- protected void setSelectionToWidget(List l, boolean reveal) {
- // TODO Auto-generated method stub
-
- }
-
- public Control getControl() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressItem.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/progress/ProgressItem.java
diff -N Eclipse UI/org/eclipse/ui/internal/progress/ProgressItem.java
--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressItem.java 25 Feb 2005 20:52:21 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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.ui.internal.progress;
-
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * The ProgressItem is the element that is represented in the
- * FullProgressViewer.
- *
- */
-public class ProgressItem extends Composite{
-
-
- private JobTreeElement element;
-
- /**
- * Create a new instance of the receiver with the
- * parent and style specified.
- * @param parent
- * @param style
- */
- public ProgressItem(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * Get the element we are representing.
- * @return JobTreeElement
- */
- public JobTreeElement getElement() {
- return element;
- }
-
- /**
- * Set the element to represent.
- * @param element
- */
- public void setElement(JobTreeElement element) {
- this.element = element;
- }
-
-
-}
Index: Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchMonitorProvider.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchMonitorProvider.java
diff -N Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchMonitorProvider.java
--- Eclipse UI/org/eclipse/ui/internal/progress/WorkbenchMonitorProvider.java 25 Feb 2005 20:52:21 -0000 1.19
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 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.ui.internal.progress;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.progress.UIJob;
-
-/**
- * The WorkbenchProgressListener is a class that listens to progress on the
- * workbench and reports accordingly.
- */
-class WorkbenchMonitorProvider {
- /**
- * Get the progress monitor for a job. If it is a UIJob get the main
- * monitor from the status line. Otherwise return no monitor.
- *
- * @return IProgressMonitor
- */
- IProgressMonitor getMonitor(Job job) {
- if (job instanceof UIJob)
- return getUIProgressMonitor(job.getName());
- else
- return new NullProgressMonitor();
- }
-
- /**
- * Return the status line manager if there is one.
- *
- * @return IStatusLineWithProgressManager
- */
- private IStatusLineManager getStatusLineManager() {
- if (PlatformUI.isWorkbenchRunning()) {
- IWorkbenchWindow window = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow();
- if (window != null && window instanceof WorkbenchWindow) {
- return ((WorkbenchWindow) window).getStatusLineManager();
- }
- }
- return null;
- }
-
- /**
- * Get a progress monitor for use with UIThreads. This monitor will use the
- * status line directly if possible.
- *
- * @param jobName.
- * Used if the task name is null.
- * @return IProgressMonitor
- */
- private IProgressMonitor getUIProgressMonitor(final String jobName) {
- return new IProgressMonitor() {
- IProgressMonitor internalMonitor;
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String,
- * int)
- */
- public void beginTask(String name, int totalWork) {
- if (name == null || name.length() == 0)
- getInternalMonitor().beginTask(jobName, totalWork);
- else
- getInternalMonitor().beginTask(name, totalWork);
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#done()
- */
- public void done() {
- getInternalMonitor().done();
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- getInternalMonitor().internalWorked(work);
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#isCanceled()
- */
- public boolean isCanceled() {
- return getInternalMonitor().isCanceled();
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean value) {
- getInternalMonitor().setCanceled(value);
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
- */
- public void setTaskName(String name) {
- getInternalMonitor().setTaskName(name);
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
- */
- public void subTask(String name) {
- getInternalMonitor().subTask(name);
- }
-
- /*
- * (non-Javadoc) @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- getInternalMonitor().worked(work);
- }
-
- /**
- * Get the monitor that is being wrapped. This is called lazily as
- * we will not be able to get the monitor for the workbench outside
- * of the UI Thread and so we will have to wait until the monitor
- * is accessed.
- *
- * Return a NullProgressMonitor if the one from the workbench
- * cannot be found.
- *
- * @return IProgressMonitor
- */
- private IProgressMonitor getInternalMonitor() {
- if (internalMonitor == null) {
- IStatusLineManager manager = getStatusLineManager();
- if (manager == null)
- internalMonitor = new NullProgressMonitor();
- else
- internalMonitor = manager.getProgressMonitor();
- }
- return internalMonitor;
- }
- };
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/registry/InstanceTracker.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/registry/InstanceTracker.java
diff -N Eclipse UI/org/eclipse/ui/internal/registry/InstanceTracker.java
--- Eclipse UI/org/eclipse/ui/internal/registry/InstanceTracker.java 25 Feb 2005 20:52:20 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.registry;
-
-import org.eclipse.core.internal.runtime.InternalPlatform;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-/**
- * This will be defined in core, I've put it into ui for now to keep it all together.
- * EXPERIMENTAL
- * @since 3.1
- */
-public class InstanceTracker {
- private IConfigurationElement configElt; //A reference to the configuration element
- private Object instance; //The instance created by calling createExecutableExtension
- private Runnable onDispose; //The code being run when the configuration element is being disposed.
-
- //Need to deal with the synchronization issues
- final BundleListener listener = new BundleListener() {
- public void bundleChanged(BundleEvent event) {
- if (configElt == null)
- return;
-
- if (event.getType() != BundleEvent.UNINSTALLED && event.getType() != BundleEvent.UNRESOLVED && event.getType() != BundleEvent.UPDATED)
- return;
-
- if(! configElt.getDeclaringExtension().getNamespace().equals(event.getBundle().getSymbolicName()))
- return;
-
- try {
- onDispose.run();
- } catch (Exception e) {
- System.out.println(e); //TODO log
- } finally {
- close();
- }
- }
-
- };
-
- public InstanceTracker(IConfigurationElement config, Runnable onDispose) {
- configElt = config;
- this.onDispose = onDispose;
- }
-
- public Object getExecutableExtension(String property) throws CoreException {
- if (instance != null)
- return instance;
-
- if (configElt == null)
- return null;
-
- instance = configElt.createExecutableExtension(property);
-
- if (instance != null && onDispose != null)
- track();
-
- return instance;
- }
-
- private void track() {
- InternalPlatform.getDefault().getBundleContext().addBundleListener(listener);
- }
-
- public void close() {
- InternalPlatform.getDefault().getBundleContext().removeBundleListener(listener);
- instance = null;
- configElt = null;
- onDispose = null;
- }
-
- public IConfigurationElement getConfigurationElement() {
- return configElt;
- }
-
- /**
- *
- */
- public void releaseExecutableExtension() {
- instance = null;
- }
-}
Index: Eclipse UI/org/eclipse/ui/internal/util/OldConfigurationElementMemento.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/util/OldConfigurationElementMemento.java
diff -N Eclipse UI/org/eclipse/ui/internal/util/OldConfigurationElementMemento.java
--- Eclipse UI/org/eclipse/ui/internal/util/OldConfigurationElementMemento.java 25 Feb 2005 20:52:23 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 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.ui.internal.util;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IMemento;
-
-public final class OldConfigurationElementMemento implements IMemento {
-
- private IConfigurationElement configurationElement;
-
- public OldConfigurationElementMemento(
- IConfigurationElement configurationElement) {
- if (configurationElement == null)
- throw new NullPointerException();
-
- this.configurationElement = configurationElement;
- }
-
- public IMemento createChild(String type) {
- return null;
- }
-
- public IMemento createChild(String type, String id) {
- return null;
- }
-
- public IMemento getChild(String type) {
- IConfigurationElement[] configurationElements = configurationElement
- .getChildren(type);
-
- if (configurationElements != null && configurationElements.length >= 1)
- return new OldConfigurationElementMemento(configurationElements[0]);
-
- return null;
- }
-
- public IMemento[] getChildren(String type) {
- IConfigurationElement[] configurationElements = configurationElement
- .getChildren(type);
-
- if (configurationElements != null && configurationElements.length >= 1) {
- IMemento mementos[] = new OldConfigurationElementMemento[configurationElements.length];
-
- for (int i = 0; i < configurationElements.length; i++)
- mementos[i] = new OldConfigurationElementMemento(
- configurationElements[i]);
-
- return mementos;
- }
-
- return new IMemento[0];
- }
-
- public Float getFloat(String key) {
- String string = configurationElement.getAttribute(key);
-
- if (string != null)
- try {
- return new Float(string);
- } catch (NumberFormatException eNumberFormat) {
- }
-
- return null;
- }
-
- public String getID() {
- return configurationElement.getAttribute(TAG_ID);
- }
-
- public Integer getInteger(String key) {
- String string = configurationElement.getAttribute(key);
-
- if (string != null)
- try {
- return new Integer(string);
- } catch (NumberFormatException eNumberFormat) {
- }
-
- return null;
- }
-
- public String getString(String key) {
- return configurationElement.getAttribute(key);
- }
-
- public String getTextData() {
- return configurationElement.getValue();
- }
-
- public void putFloat(String key, float value) {
- }
-
- public void putInteger(String key, int value) {
- }
-
- public void putMemento(IMemento memento) {
- }
-
- public void putString(String key, String value) {
- }
-
- public void putTextData(String data) {
- }
-}
Index: META-INF/MANIFEST.MF
===================================================================
RCS file: /home/eclipse/org.eclipse.ui.workbench/META-INF/MANIFEST.MF,v
retrieving revision 1.3
diff -u -r1.3 MANIFEST.MF
--- META-INF/MANIFEST.MF 6 Apr 2005 20:19:36 -0000 1.3
+++ META-INF/MANIFEST.MF 13 Apr 2005 18:29:48 -0000
@@ -28,9 +28,7 @@
org.eclipse.ui.internal.application;x-internal:=true,
org.eclipse.ui.internal.browser;x-internal:=true,
org.eclipse.ui.internal.commands;x-internal:=true,
- org.eclipse.ui.internal.commands.ws;x-internal:=true,
org.eclipse.ui.internal.contexts;x-internal:=true,
- org.eclipse.ui.internal.contexts.ws;x-internal:=true,
org.eclipse.ui.internal.decorators;x-internal:=true,
org.eclipse.ui.internal.dialogs;x-internal:=true,
org.eclipse.ui.internal.dnd;x-internal:=true,
@@ -39,7 +37,6 @@
org.eclipse.ui.internal.help;x-internal:=true,
org.eclipse.ui.internal.intro;x-internal:=true,
org.eclipse.ui.internal.keys;x-internal:=true,
- org.eclipse.ui.internal.keywords;x-internal:=true,
org.eclipse.ui.internal.layout;x-internal:=true,
org.eclipse.ui.internal.misc;x-internal:=true,
org.eclipse.ui.internal.part;x-internal:=true,
Index: Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
diff -N Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Eclipse UI/org/eclipse/ui/internal/commands/WorkbenchCommandSupport.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 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.ui.internal.commands;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.commands.CommandManager;
+import org.eclipse.core.commands.contexts.ContextManager;
+import org.eclipse.jface.bindings.BindingManager;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.LegacyHandlerSubmissionExpression;
+import org.eclipse.ui.commands.HandlerSubmission;
+import org.eclipse.ui.commands.ICommandManager;
+import org.eclipse.ui.commands.IWorkbenchCommandSupport;
+import org.eclipse.ui.commands.Priority;
+import org.eclipse.ui.handlers.IHandlerActivation;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.internal.handlers.LegacyHandlerWrapper;
+
+/**
+ * Provides command support in terms of the workbench.
+ *
+ * @since 3.0
+ */
+public class WorkbenchCommandSupport implements IWorkbenchCommandSupport {
+
+ /**
+ * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
+ * indexed by the submissions (<code>HandlerSubmission</code>). This map
+ * should be <code>null</code> if there are no such activations.
+ */
+ private Map activationsBySubmission = null;
+
+ /**
+ * The mutable command manager that should be notified of changes to the
+ * list of active handlers. This value is never <code>null</code>.
+ */
+ private final CommandManagerWrapper commandManagerWrapper;
+
+ /**
+ * The handler service for the workbench. This value is never
+ * <code>null</code>.
+ */
+ private final IHandlerService handlerService;
+
+ /**
+ * Constructs a new instance of <code>WorkbenchCommandSupport</code>
+ *
+ * @param bindingManager
+ * The binding manager providing support for the command manager;
+ * must not be <code>null</code>.
+ * @param commandManager
+ * The command manager for the workbench; must not be
+ * <code>null</code>.
+ * @param contextManager
+ * The context manager providing support for the command manager
+ * and binding manager; must not be <code>null</code>.
+ * @param handlerService
+ * The handler service for the workbench; must not be
+ * <code>null</code>.
+ */
+ public WorkbenchCommandSupport(final BindingManager bindingManager,
+ final CommandManager commandManager,
+ final ContextManager contextManager,
+ final IHandlerService handlerService) {
+ if (handlerService == null) {
+ throw new NullPointerException("The handler service cannot be null"); //$NON-NLS-1$
+ }
+
+ this.handlerService = handlerService;
+
+ commandManagerWrapper = CommandManagerFactory.getCommandManagerWrapper(
+ bindingManager, commandManager, contextManager);
+
+ // Initialize the old key formatter settings.
+ org.eclipse.ui.keys.KeyFormatterFactory
+ .setDefault(org.eclipse.ui.keys.SWTKeySupport
+ .getKeyFormatterForPlatform());
+ }
+
+ public final void addHandlerSubmission(
+ final HandlerSubmission handlerSubmission) {
+ /*
+ * Create the source priorities based on the conditions mentioned in the
+ * submission.
+ */
+ int sourcePriorities = 0;
+ if (handlerSubmission.getActivePartId() != null) {
+ sourcePriorities |= ISources.ACTIVE_PART;
+ }
+ if (handlerSubmission.getActiveShell() != null) {
+ sourcePriorities |= (ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW);
+ }
+ if (handlerSubmission.getActiveWorkbenchPartSite() != null) {
+ sourcePriorities |= ISources.ACTIVE_SITE;
+ }
+ if (handlerSubmission.getPriority() == Priority.LEGACY) {
+ sourcePriorities |= ISources.LEGACY_LEGACY;
+ } else if (handlerSubmission.getPriority() == Priority.LOW) {
+ sourcePriorities |= ISources.LEGACY_LOW;
+ } else if (handlerSubmission.getPriority() == Priority.MEDIUM) {
+ sourcePriorities |= ISources.LEGACY_MEDIUM;
+ }
+
+ final IHandlerActivation activation = handlerService.activateHandler(
+ handlerSubmission.getCommandId(), new LegacyHandlerWrapper(
+ handlerSubmission.getHandler()),
+ new LegacyHandlerSubmissionExpression(handlerSubmission
+ .getActivePartId(), handlerSubmission.getActiveShell(),
+ handlerSubmission.getActiveWorkbenchPartSite()),
+ sourcePriorities);
+ if (activationsBySubmission == null) {
+ activationsBySubmission = new HashMap();
+ }
+ activationsBySubmission.put(handlerSubmission, activation);
+ }
+
+ public final void addHandlerSubmissions(final Collection handlerSubmissions) {
+ final Iterator submissionItr = handlerSubmissions.iterator();
+ while (submissionItr.hasNext()) {
+ addHandlerSubmission((HandlerSubmission) submissionItr.next());
+ }
+ }
+
+ public ICommandManager getCommandManager() {
+ return commandManagerWrapper;
+ }
+
+ public final void removeHandlerSubmission(
+ final HandlerSubmission handlerSubmission) {
+ if (activationsBySubmission == null) {
+ return;
+ }
+
+ final Object value = activationsBySubmission.remove(handlerSubmission);
+ if (value instanceof IHandlerActivation) {
+ final IHandlerActivation activation = (IHandlerActivation) value;
+ handlerService.deactivateHandler(activation);
+ }
+ }
+
+ public final void removeHandlerSubmissions(
+ final Collection handlerSubmissions) {
+ final Iterator submissionItr = handlerSubmissions.iterator();
+ while (submissionItr.hasNext()) {
+ removeHandlerSubmission((HandlerSubmission) submissionItr.next());
+ }
+ }
+}
Index: Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
diff -N Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Eclipse UI/org/eclipse/ui/internal/contexts/WorkbenchContextSupport.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 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.ui.internal.contexts;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.commands.contexts.ContextManager;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.ISources;
+import org.eclipse.ui.LegacyHandlerSubmissionExpression;
+import org.eclipse.ui.contexts.EnabledSubmission;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextManager;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.contexts.IWorkbenchContextSupport;
+import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.keys.IBindingService;
+
+/**
+ * Provides support for contexts within the workbench -- including key bindings,
+ * and some default contexts for shell types.
+ *
+ * @since 3.0
+ */
+public class WorkbenchContextSupport implements IWorkbenchContextSupport {
+
+ /**
+ * The map of activations that have been given to the handler service (<code>IHandlerActivation</code>),
+ * indexed by the submissions (<code>HandlerSubmission</code>). This map
+ * should be <code>null</code> if there are no such activations.
+ */
+ private Map activationsBySubmission = null;
+
+ /**
+ * The binding service for the workbench. This value is never
+ * <code>null</code>.
+ */
+ private IBindingService bindingService;
+
+ /**
+ * The context service for the workbench. This value is never
+ * <code>null</code>.
+ */
+ private IContextService contextService;
+
+ /**
+ * The legacy context manager supported by this application.
+ */
+ private ContextManagerWrapper contextManagerWrapper;
+
+ /**
+ * The workbench for which context support is being provided. This value
+ * must not be <code>null</code>.
+ */
+ private final Workbench workbench;
+
+ /**
+ * Constructs a new instance of <code>WorkbenchCommandSupport</code>.
+ * This attaches the key binding support, and adds a global shell activation
+ * filter.
+ *
+ * @param workbenchToSupport
+ * The workbench that needs to be supported by this instance;
+ * must not be <code>null</code>.
+ * @param contextManager
+ * The context manager to be wrappered; must not be
+ * <code>null</code>.
+ */
+ public WorkbenchContextSupport(final Workbench workbenchToSupport,
+ final ContextManager contextManager) {
+ workbench = workbenchToSupport;
+ contextService = (IContextService) workbench
+ .getAdapter(IContextService.class);
+ bindingService = (IBindingService) workbench
+ .getAdapter(IBindingService.class);
+ contextManagerWrapper = ContextManagerFactory
+ .getContextManagerWrapper(contextManager);
+ }
+
+ public final void addEnabledSubmission(
+ final EnabledSubmission enabledSubmission) {
+ /*
+ * Create the source priorities based on the conditions mentioned in the
+ * submission.
+ */
+ int sourcePriorities = 0;
+ if (enabledSubmission.getActivePartId() != null) {
+ sourcePriorities |= ISources.ACTIVE_PART;
+ }
+ if (enabledSubmission.getActiveShell() != null) {
+ sourcePriorities |= (ISources.ACTIVE_SHELL | ISources.ACTIVE_WORKBENCH_WINDOW);
+ }
+ if (enabledSubmission.getActiveWorkbenchPartSite() != null) {
+ sourcePriorities |= ISources.ACTIVE_SITE;
+ }
+
+ final IContextActivation activation = contextService.activateContext(
+ enabledSubmission.getContextId(),
+ new LegacyHandlerSubmissionExpression(enabledSubmission
+ .getActivePartId(), enabledSubmission.getActiveShell(),
+ enabledSubmission.getActiveWorkbenchPartSite()),
+ sourcePriorities);
+ if (activationsBySubmission == null) {
+ activationsBySubmission = new HashMap();
+ }
+ activationsBySubmission.put(enabledSubmission, activation);
+ }
+
+ public final void addEnabledSubmissions(final Collection enabledSubmissions) {
+ final Iterator submissionItr = enabledSubmissions.iterator();
+ while (submissionItr.hasNext()) {
+ addEnabledSubmission((EnabledSubmission) submissionItr.next());
+ }
+ }
+
+ public final IContextManager getContextManager() {
+ return contextManagerWrapper;
+ }
+
+ public final int getShellType(Shell shell) {
+ return contextService.getShellType(shell);
+ }
+
+ public final boolean isKeyFilterEnabled() {
+ return bindingService.isKeyFilterEnabled();
+ }
+
+ public final void openKeyAssistDialog() {
+ bindingService.openKeyAssistDialog();
+ }
+
+ public final boolean registerShell(final Shell shell, final int type) {
+ return contextService.registerShell(shell, type);
+ }
+
+ public final void removeEnabledSubmission(
+ final EnabledSubmission enabledSubmission) {
+ if (activationsBySubmission == null) {
+ return;
+ }
+
+ final Object value = activationsBySubmission.remove(enabledSubmission);
+ if (value instanceof IContextActivation) {
+ final IContextActivation activation = (IContextActivation) value;
+ contextService.deactivateContext(activation);
+ }
+ }
+
+ public final void removeEnabledSubmissions(
+ final Collection enabledSubmissions) {
+ final Iterator submissionItr = enabledSubmissions.iterator();
+ while (submissionItr.hasNext()) {
+ removeEnabledSubmission((EnabledSubmission) submissionItr.next());
+ }
+ }
+
+ public final void setKeyFilterEnabled(final boolean enabled) {
+ bindingService.setKeyFilterEnabled(enabled);
+ }
+
+ public final boolean unregisterShell(final Shell shell) {
+ return contextService.unregisterShell(shell);
+ }
+}
Index: Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
diff -N Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Eclipse UI/org/eclipse/ui/internal/registry/KeywordRegistry.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2005 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.ui.internal.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.dynamichelpers.ExtensionTracker;
+import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
+import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IWorkbenchConstants;
+
+/**
+ * Contains extensions defined on the <code>keywords</code> extension point.
+ *
+ * @since 3.1
+ */
+public final class KeywordRegistry implements IExtensionChangeHandler {
+
+ private static final String ATT_ID = "id"; //$NON-NLS-1$
+
+ private static final String ATT_LABEL = "label"; //$NON-NLS-1$
+
+ private static KeywordRegistry instance;
+
+ private static final String TAG_KEYWORD = "keyword"; //$NON-NLS-1$
+
+ /**
+ * Return the singleton instance of the <code>KeywordRegistry</code>.
+ *
+ * @return the singleton registry
+ */
+ public static KeywordRegistry getInstance() {
+ if (instance == null) {
+ instance = new KeywordRegistry();
+ }
+
+ return instance;
+ }
+
+ /**
+ * Map of id->labels.
+ */
+ private Map internalKeywordMap = new HashMap();
+
+ /**
+ * Private constructor.
+ */
+ private KeywordRegistry() {
+ IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker();
+ tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter(getExtensionPointFilter()));
+ IExtension[] extensions = getExtensionPointFilter().getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ addExtension(PlatformUI.getWorkbench().getExtensionTracker(),
+ extensions[i]);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.dynamicHelpers.IExtensionChangeHandler#addExtension(org.eclipse.core.runtime.dynamicHelpers.IExtensionTracker, org.eclipse.core.runtime.IExtension)
+ */
+ public void addExtension(IExtensionTracker tracker, IExtension extension) {
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i].getName().equals(TAG_KEYWORD)) {
+ String name = elements[i].getAttribute(ATT_LABEL);
+ String id = elements[i].getAttribute(ATT_ID);
+ internalKeywordMap.put(id, name);
+ PlatformUI.getWorkbench().getExtensionTracker().registerObject(
+ extension, id, IExtensionTracker.REF_WEAK);
+ }
+ }
+ }
+
+ private IExtensionPoint getExtensionPointFilter() {
+ return Platform.getExtensionRegistry().getExtensionPoint(
+ PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_KEYWORDS);
+ }
+
+ /**
+ * Return the label associated with the given keyword.
+ *
+ * @param id the keyword id
+ * @return the label or <code>null</code>
+ */
+ public String getKeywordLabel(String id) {
+ return (String) internalKeywordMap.get(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.dynamicHelpers.IExtensionChangeHandler#removeExtension(org.eclipse.core.runtime.IExtension, java.lang.Object[])
+ */
+ public void removeExtension(IExtension extension, Object[] objects) {
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof String) {
+ internalKeywordMap.remove(objects[i]);
+ }
+ }
+ }
+}