aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2012-05-11 06:14:37 (EDT)
committerUwe Stieber2012-05-11 06:14:37 (EDT)
commit1051656fd709b3af2ee69f6eebdbc81fe03bf2e6 (patch)
tree1d96cc38cc857da2ecf017b3ee72002e7ade79f2
parentb1b25b04fd882636c40887119a2b8c41ce4dd2e9 (diff)
downloadorg.eclipse.tcf-1051656fd709b3af2ee69f6eebdbc81fe03bf2e6.zip
org.eclipse.tcf-1051656fd709b3af2ee69f6eebdbc81fe03bf2e6.tar.gz
org.eclipse.tcf-1051656fd709b3af2ee69f6eebdbc81fe03bf2e6.tar.bz2
Target Explorer: ADD favorites handling for launches
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ICommonLaunchAttributes.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/preferences/IPreferenceKeys.java118
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml63
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/PreferencesInitializer.java38
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/AdapterFactory.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/CategorizableAdapter.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/DeleteHandler.java25
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchEditorContentProvider.java (renamed from target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeContentProvider.java)4
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchFavoritesContentProvider.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java182
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java187
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java14
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/ChangeEvent.java243
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml972
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/CategoryAddToContributionItem.java130
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryAddToContributionItem.java127
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java90
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryPropertyTester.java271
21 files changed, 1578 insertions, 1041 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
index 7b1e152..458b6ed 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/delegates/DefaultLaunchManagerDelegate.java
@@ -16,6 +16,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.UUID;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
@@ -30,6 +31,7 @@ import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.interfaces.tracing.ITraceIds;
import org.eclipse.tcf.te.launch.core.lm.LaunchConfigSorter;
import org.eclipse.tcf.te.launch.core.lm.LaunchSpecification;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.IFileTransferLaunchAttributes;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchAttribute;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchContextLaunchAttributes;
@@ -37,6 +39,7 @@ import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchManagerDelegate;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ILaunchSpecification;
import org.eclipse.tcf.te.launch.core.lm.interfaces.IReferencedProjectLaunchAttributes;
import org.eclipse.tcf.te.launch.core.nls.Messages;
+import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.filetransfer.FileTransfersPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
@@ -71,6 +74,11 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
public void initLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
Assert.isNotNull(wc);
Assert.isNotNull(launchSpec);
+
+ if (!DefaultPersistenceDelegate.hasAttribute(wc, ICommonLaunchAttributes.ATTR_UUID)) {
+ DefaultPersistenceDelegate.setAttribute(wc, ICommonLaunchAttributes.ATTR_UUID, UUID.randomUUID().toString());
+ }
+
validateLaunchSpecification(launchSpec);
}
@@ -81,6 +89,11 @@ public class DefaultLaunchManagerDelegate extends ExecutableExtension implements
public void updateLaunchConfigAttributes(ILaunchConfigurationWorkingCopy wc, ILaunchSpecification launchSpec) {
Assert.isNotNull(wc);
Assert.isNotNull(launchSpec);
+
+ if (!DefaultPersistenceDelegate.hasAttribute(wc, ICommonLaunchAttributes.ATTR_UUID)) {
+ DefaultPersistenceDelegate.setAttribute(wc, ICommonLaunchAttributes.ATTR_UUID, UUID.randomUUID().toString());
+ }
+
validateLaunchSpecification(launchSpec);
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ICommonLaunchAttributes.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ICommonLaunchAttributes.java
index 85caec4..0ca5cdc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ICommonLaunchAttributes.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/lm/interfaces/ICommonLaunchAttributes.java
@@ -20,6 +20,11 @@ public interface ICommonLaunchAttributes {
public static final String ATTR_PREFIX = "org.eclipse.tcf.te.launch"; //$NON-NLS-1$
/**
+ * Unique identifier.
+ */
+ public static final String ATTR_UUID = ATTR_PREFIX + ".UUID"; //$NON-NLS-1$
+
+ /**
* Time stamp when last launched.
*/
public static final String ATTR_LAST_LAUNCHED = ATTR_PREFIX + ".lastLaunched"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/preferences/IPreferenceKeys.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/preferences/IPreferenceKeys.java
index cee4ca5..cbfa4ee 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/preferences/IPreferenceKeys.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.core/src/org/eclipse/tcf/te/launch/core/preferences/IPreferenceKeys.java
@@ -1,56 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.launch.core.preferences;
-
-
-/**
- * The locator model bundle preference key identifiers.
- */
-public interface IPreferenceKeys {
- /**
- * Common prefix for all core preference keys
- */
- public final String PREFIX = "te.launch.core."; //$NON-NLS-1$
-
- /**
- * Launch configuration find/create mode: Always create new launch configurations.
- */
- public static final int MODE_ALWAYS_NEW = 0;
-
- /**
- * Launch configuration find/create mode: Re-use launch configuration if all attributes are matching.
- */
- public static final int MODE_FULL_MATCH_LAUNCH_CONFIG = 1;
-
- /**
- * Launch configuration find/create mode: Re-use launch configuration if the target ID matches.
- */
- public static final int MODE_FULL_MATCH_TARGET = 2;
-
- /**
- * Launch configuration find/create mode: Re-use first matching launch configuration.
- */
- public static final int MODE_FIRST_MATCHING = 3;
-
- /**
- * Launch configuration find/create mode. See the <code>MODE_*</code> constants.
- */
- public static final String PREF_LAUNCH_CONFIG_FIND_CREATE_MODE = PREFIX + "launchConfigFindCreateMode"; //$NON-NLS-1$
-
- /**
- * If set to <code>true</code>, project references will be added by default to newly created launch configurations.
- */
- public static final String PREF_ADD_PROJECT_TO_NEW_LAUNCH_CONFIG = PREFIX + "addProjectToNewLaunchConfig"; //$NON-NLS-1$
-
- /**
- * If set to <code>true</code>, launches are sorted by their last launched time stamp.
- */
- public static final String PREF_SORT_LAUNCHES_BY_LAST_LAUNCHED = PREFIX + ".sortLaunchesByLastLaunched"; //$NON-NLS-1$
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.core.preferences;
+
+
+/**
+ * The locator model bundle preference key identifiers.
+ */
+public interface IPreferenceKeys {
+ /**
+ * Common prefix for all core preference keys
+ */
+ public final String PREFIX = "te.launch.core."; //$NON-NLS-1$
+
+ /**
+ * Launch configuration find/create mode: Always create new launch configurations.
+ */
+ public static final int MODE_ALWAYS_NEW = 0;
+
+ /**
+ * Launch configuration find/create mode: Re-use launch configuration if all attributes are matching.
+ */
+ public static final int MODE_FULL_MATCH_LAUNCH_CONFIG = 1;
+
+ /**
+ * Launch configuration find/create mode: Re-use launch configuration if the target ID matches.
+ */
+ public static final int MODE_FULL_MATCH_TARGET = 2;
+
+ /**
+ * Launch configuration find/create mode: Re-use first matching launch configuration.
+ */
+ public static final int MODE_FIRST_MATCHING = 3;
+
+ /**
+ * Launch configuration find/create mode. See the <code>MODE_*</code> constants.
+ */
+ public static final String PREF_LAUNCH_CONFIG_FIND_CREATE_MODE = PREFIX + "launchConfigFindCreateMode"; //$NON-NLS-1$
+
+ /**
+ * If set to <code>true</code>, project references will be added by default to newly created launch configurations.
+ */
+ public static final String PREF_ADD_PROJECT_TO_NEW_LAUNCH_CONFIG = PREFIX + "addProjectToNewLaunchConfig"; //$NON-NLS-1$
+
+ /**
+ * If set to <code>true</code>, launches are sorted by their last launched time stamp.
+ */
+ public static final String PREF_SORT_LAUNCHES_BY_LAST_LAUNCHED = PREFIX + ".sortLaunchesByLastLaunched"; //$NON-NLS-1$
+
+ /**
+ * Preference key to access the flag to hide favorite launches content extension.
+ */
+ public static final String PREF_HIDE_FAVORITE_LAUNCHES_EXTENSION = "org.eclipse.tcf.te.tcf.launch.ui.navigator.favorites.content.hide"; //$NON-NLS-1$
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
index c7933be..dddb293 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.properties
@@ -50,9 +50,10 @@ ShowIn.menu.name=Show In
Properties.menu.name=Properties
Run.menu.name=Run
Debug.menu.name=Debug
+AddTo.menu.name=Add To
command.delete.label=Delete
command.delete.description=Delete the selected node
-LauchTree.name=Launches
+LaunchTree.name=Launches
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
index cfa8ee1..53fe6ff 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/plugin.xml
@@ -2,12 +2,18 @@
<?eclipse version="3.4"?>
<plugin>
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.launch.ui.internal.PreferencesInitializer"/>
+ </extension>
+
<!-- Adapter factory contributions -->
<extension point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.tcf.te.launch.ui.model.LaunchNode"
class="org.eclipse.tcf.te.launch.ui.internal.adapters.AdapterFactory">
<adapter type="org.eclipse.jface.viewers.ILabelProvider"/>
+ <adapter type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
</factory>
</extension>
@@ -46,8 +52,26 @@
<!-- Navigator content contributions -->
<extension point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
+ id="org.eclipse.tcf.te.tcf.launch.ui.navigator.favorites.content"
+ name="%LaunchTree.name"
+ activeByDefault="true"
+ contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchFavoritesContentProvider"
+ labelProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider"
+ priority="normal">
+ <triggerPoints>
+ <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof value="org.eclipse.tcf.te.launch.ui.model.LaunchNode"/>
+ </possibleChildren>
+ <commonSorter class="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeViewerSorter"/>
+ </navigatorContent>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <navigatorContent
id="org.eclipse.tcf.te.launch.ui.navigator.project.content"
- name="%LauchTree.name"
+ name="%LaunchTree.name"
icon="icons/obj16/launches_root.gif"
activeByDefault="false"
contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider"
@@ -78,7 +102,7 @@
<viewer
id="org.eclipse.tcf.te.launch.ui.viewer.launches"
autoExpandLevel="2"
- contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeContentProvider"
+ contentProvider="org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchEditorContentProvider"
doubleClickCommand="org.eclipse.ui.navigator.Open"
helpId="org.eclipse.tcf.te.launch.ui.LaunchEditorPage"
menuId="org.eclipse.tcf.te.launch.ui.editor.menu.launches">
@@ -381,8 +405,43 @@
<reference definitionId="launch.expressions.isSingleLaunchNode"/>
</visibleWhen>
</command>
+ <separator
+ name="group.categories"
+ visible="true"/>
+ <menu
+ id="org.eclipse.tcf.te.launch.ui.editor.menu.addTo"
+ label="%AddTo.menu.name">
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.addTo.multi"
+ class="org.eclipse.tcf.te.ui.views.handler.CategoryAddToContributionItem">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="(1-"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ <visibleWhen>
+ <reference definitionId="launch.expressions.isSingleLaunchConfig"/>
+ </visibleWhen>
+ </menu>
+ <dynamic
+ id="org.eclipse.tcf.te.launch.ui.editor.dynamic.addTo.single"
+ class="org.eclipse.tcf.te.ui.views.handler.CategoryAddToContributionItem">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
</menuContribution>
+
<!-- Launches editor page toolbar contributions -->
<menuContribution locationURI="toolbar:org.eclipse.tcf.te.launch.ui.editor.menu.launches">
<separator
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/PreferencesInitializer.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/PreferencesInitializer.java
new file mode 100644
index 0000000..7f8f398
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/PreferencesInitializer.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.tcf.te.launch.core.preferences.IPreferenceKeys;
+import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
+
+
+/**
+ * The bundle's preference initializer implementation.
+ */
+public class PreferencesInitializer extends AbstractPreferenceInitializer {
+ /**
+ * Constructor.
+ */
+ public PreferencesInitializer() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = UIPlugin.getDefault().getPreferenceStore();
+ // [Hidden] Hide dynamic target discovery navigator content extension: default on
+ store.setDefault(IPreferenceKeys.PREF_HIDE_FAVORITE_LAUNCHES_EXTENSION, true);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/AdapterFactory.java
index d98bc6b..71768fc 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/AdapterFactory.java
@@ -13,6 +13,7 @@ import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchTreeLabelProvider;
import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
/**
* Adapter factory implementation.
@@ -27,9 +28,13 @@ public class AdapterFactory implements IAdapterFactory {
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof LaunchNode) {
+ LaunchNode node = (LaunchNode)adaptableObject;
if (ILabelProvider.class.equals(adapterType)) {
return labelProvider;
}
+ if (ICategorizable.class.equals(adapterType) && node.getLaunchConfiguration() != null) {
+ return new CategorizableAdapter(node);
+ }
}
return null;
}
@@ -40,7 +45,8 @@ public class AdapterFactory implements IAdapterFactory {
@Override
public Class[] getAdapterList() {
return new Class<?>[] {
- ILabelProvider.class
+ ILabelProvider.class,
+ ICategorizable.class
};
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/CategorizableAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/CategorizableAdapter.java
new file mode 100644
index 0000000..1ac1d3c
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/adapters/CategorizableAdapter.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal.adapters;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
+import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
+import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
+
+/**
+ * Categorizable launch config node adapter implementation
+ */
+public class CategorizableAdapter implements ICategorizable {
+ // Reference to the adapted element
+ private final LaunchNode node;
+
+ /**
+ * Constructor.
+ *
+ * @param node The adapted launch config node. Must not be <code>null</code>.
+ */
+ public CategorizableAdapter(LaunchNode node) {
+ Assert.isNotNull(node);
+ this.node = node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable#getId()
+ */
+ @Override
+ public String getId() {
+ return LaunchModel.getCategoryId(node.getLaunchConfiguration());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable#isValid(org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable.OPERATION, org.eclipse.tcf.te.ui.views.interfaces.ICategory, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
+ */
+ @Override
+ public boolean isValid(OPERATION operation, ICategory parentCategory, ICategory category) {
+ Assert.isNotNull(operation);
+ Assert.isNotNull(category);
+
+ if (OPERATION.REMOVE.equals(operation) && parentCategory != null && IUIConstants.ID_CAT_FAVORITES.equals(parentCategory.getId())) {
+ return true;
+ }
+ if (OPERATION.ADD.equals(operation) && category != null && IUIConstants.ID_CAT_FAVORITES.equals(category.getId())) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable#isEnabled(org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable.OPERATION, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
+ */
+ @Override
+ public boolean isEnabled(OPERATION operation, ICategory category) {
+ Assert.isNotNull(operation);
+ Assert.isNotNull(category);
+
+ if (OPERATION.REMOVE.equals(operation)) {
+ return Managers.getCategoryManager().belongsTo(IUIConstants.ID_CAT_FAVORITES, getId());
+ }
+ if (OPERATION.ADD.equals(operation)) {
+ return !Managers.getCategoryManager().belongsTo(IUIConstants.ID_CAT_FAVORITES, getId());
+ }
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/DeleteHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/DeleteHandler.java
index 5acb14b..e04476f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/DeleteHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/DeleteHandler.java
@@ -20,8 +20,11 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
+import org.eclipse.tcf.te.launch.ui.model.LaunchModel;
import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
import org.eclipse.tcf.te.launch.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
import org.eclipse.ui.handlers.HandlerUtil;
/**
@@ -61,7 +64,8 @@ public class DeleteHandler extends AbstractHandler {
public boolean canDelete(Object element) {
if (element instanceof LaunchNode) {
LaunchNode node = (LaunchNode)element;
- return LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType()) && !node.getLaunchConfiguration().isReadOnly();
+ return LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType()) &&
+ (node.getModel().getModelRoot() instanceof ICategory || !node.getLaunchConfiguration().isReadOnly());
}
return false;
}
@@ -71,13 +75,18 @@ public class DeleteHandler extends AbstractHandler {
if (element instanceof LaunchNode) {
LaunchNode node = (LaunchNode)element;
- if (MessageDialog.openQuestion(
- UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
- Messages.DeleteHandlerDelegate_question_title, NLS.bind(Messages.DeleteHandlerDelegate_question_message, node.getLaunchConfiguration().getName()))) {
- try {
- node.getLaunchConfiguration().delete();
- }
- catch (Exception e) {
+ if (node.getModel().getModelRoot() instanceof ICategory) {
+ Managers.getCategoryManager().remove(((ICategory)node.getModel().getModelRoot()).getId(), LaunchModel.getCategoryId(node.getLaunchConfiguration()));
+ }
+ else {
+ if (MessageDialog.openQuestion(
+ UIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.DeleteHandlerDelegate_question_title, NLS.bind(Messages.DeleteHandlerDelegate_question_message, node.getLaunchConfiguration().getName()))) {
+ try {
+ node.getLaunchConfiguration().delete();
+ }
+ catch (Exception e) {
+ }
}
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
index 58ba1d1..566e845 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/handler/NewLaunchConfigurationContributionItem.java
@@ -42,6 +42,7 @@ import org.eclipse.tcf.te.launch.ui.activator.UIPlugin;
import org.eclipse.tcf.te.launch.ui.model.LaunchNode;
import org.eclipse.tcf.te.launch.ui.selection.LaunchSelectionManager;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
import org.eclipse.ui.ISources;
import org.eclipse.ui.actions.CompoundContributionItem;
import org.eclipse.ui.handlers.IHandlerService;
@@ -109,7 +110,10 @@ public class NewLaunchConfigurationContributionItem extends CompoundContribution
for (String mode : LaunchConfigHelper.getLaunchConfigTypeModes(type, false)) {
ILaunchManagerDelegate delegate = LaunchManager.getInstance().getLaunchManagerDelegate(type, mode);
ILaunchSelection launchSelection = null;
- if (node.getModel().getModelRoot() instanceof IModelNode) {
+ if (node.getModel().getModelRoot() instanceof ICategory) {
+ launchSelection = LaunchSelectionManager.getInstance().getLaunchSelection(type, mode, LaunchSelectionManager.PART_ID_TE_VIEW);
+ }
+ else if (node.getModel().getModelRoot() instanceof IModelNode) {
List<ISelectionContext> selectionContexts = new ArrayList<ISelectionContext>();
selectionContexts.add(new RemoteSelectionContext((IModelNode)node.getModel().getModelRoot(), true));
selectionContexts.addAll(LaunchSelectionManager.getInstance().getSelectionContextsFor(LaunchSelectionManager.PART_ID_PROJECT_VIEW, type, mode, false));
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchEditorContentProvider.java
index 7922249..d537297 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchTreeContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchEditorContentProvider.java
@@ -13,12 +13,12 @@ package org.eclipse.tcf.te.launch.ui.internal.viewer;
/**
* Launch tree content provider implementation.
*/
-public class LaunchTreeContentProvider extends LaunchNavigatorContentProvider {
+public class LaunchEditorContentProvider extends LaunchNavigatorContentProvider {
/**
* Constructor.
*/
- public LaunchTreeContentProvider() {
+ public LaunchEditorContentProvider() {
super();
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchFavoritesContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchFavoritesContentProvider.java
new file mode 100644
index 0000000..46fa4c9
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchFavoritesContentProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.launch.ui.internal.viewer;
+
+
+/**
+ * Launches content provider for the common navigator of Target Explorer.
+ */
+public class LaunchFavoritesContentProvider extends LaunchNavigatorContentProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider#isRootNodeVisible()
+ */
+ @Override
+ protected boolean isRootNodeVisible() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider#isTypeNodeVisible()
+ */
+ @Override
+ protected boolean isTypeNodeVisible() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.launch.ui.internal.viewer.LaunchNavigatorContentProvider#isEmptyTypeNodeVisible()
+ */
+ @Override
+ protected boolean isEmptyTypeNodeVisible() {
+ return false;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
index b591a0c..8604d6f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/viewer/LaunchNavigatorContentProvider.java
@@ -9,10 +9,14 @@
*******************************************************************************/
package org.eclipse.tcf.te.launch.ui.internal.viewer;
+import java.util.ArrayList;
import java.util.EventObject;
+import java.util.List;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jface.viewers.ITreePathContentProvider;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
@@ -26,12 +30,16 @@ import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
import org.eclipse.tcf.te.ui.trees.TreeContentProvider;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.extensions.CategoriesExtensionPointManager;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.IUIConstants;
import org.eclipse.ui.PlatformUI;
/**
* Launches content provider for the common navigator of Target Explorer.
*/
-public class LaunchNavigatorContentProvider extends TreeContentProvider implements IEventListener {
+public class LaunchNavigatorContentProvider extends TreeContentProvider implements ITreePathContentProvider, IEventListener {
/**
* Constructor.
@@ -48,13 +56,13 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
public Object getParent(Object element) {
if (element instanceof LaunchNode) {
LaunchNode node = (LaunchNode)element;
- if (node.getParent() == null || LaunchNode.TYPE_ROOT.equals(node.getType())) {
+ if (node.getParent() == null ||
+ LaunchNode.TYPE_ROOT.equals(node.getType()) ||
+ (!isTypeNodeVisible() && LaunchNode.TYPE_LAUNCH_CONFIG.equals(node.getType())) ||
+ (!isRootNodeVisible() && LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType()))) {
return node.getModel().getModelRoot();
}
- if (!isRootNodeVisible() && LaunchNode.TYPE_LAUNCH_CONFIG_TYPE.equals(node.getType())) {
- return node.getModel().getModelRoot();
- }
return node.getParent();
}
return null;
@@ -70,29 +78,31 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
if (newInput != null && !newInput.equals(oldInput)) {
LaunchModel model = LaunchModel.getLaunchModel(newInput);
- LaunchNode lastLaunchedNode = null;
- long nodeValue = -1;
- for (IModelNode typeNode : model.getRootNode().getChildren()) {
- for (IModelNode launchNode : ((IContainerModelNode)typeNode).getChildren()) {
- ILaunchConfiguration config = ((LaunchNode)launchNode).getLaunchConfiguration();
- String lastLaunched = DefaultPersistenceDelegate.getAttribute(config, ICommonLaunchAttributes.ATTR_LAST_LAUNCHED, (String)null);
- if (lastLaunched != null) {
- long last = Long.parseLong(lastLaunched);
- if (last > nodeValue) {
- nodeValue = last;
- lastLaunchedNode = (LaunchNode)launchNode;
+ if (model != null) {
+ LaunchNode lastLaunchedNode = null;
+ long nodeValue = -1;
+ for (IModelNode typeNode : model.getRootNode().getChildren()) {
+ for (IModelNode launchNode : ((IContainerModelNode)typeNode).getChildren()) {
+ ILaunchConfiguration config = ((LaunchNode)launchNode).getLaunchConfiguration();
+ String lastLaunched = DefaultPersistenceDelegate.getAttribute(config, ICommonLaunchAttributes.ATTR_LAST_LAUNCHED, (String)null);
+ if (lastLaunched != null) {
+ long last = Long.parseLong(lastLaunched);
+ if (last > nodeValue) {
+ nodeValue = last;
+ lastLaunchedNode = (LaunchNode)launchNode;
+ }
}
}
}
- }
- if (lastLaunchedNode != null) {
- final LaunchNode node = lastLaunchedNode;
- ExecutorsUtil.executeInUI(new Runnable() {
- @Override
- public void run() {
- viewer.setSelection(new StructuredSelection(node));
- }
- });
+ if (lastLaunchedNode != null) {
+ final LaunchNode node = lastLaunchedNode;
+ ExecutorsUtil.executeInUI(new Runnable() {
+ @Override
+ public void run() {
+ viewer.setSelection(new StructuredSelection(node));
+ }
+ });
+ }
}
}
}
@@ -116,7 +126,31 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
super.getChildren(element);
if (element instanceof LaunchNode) {
- return ((LaunchNode)element).getChildren();
+ LaunchNode node = (LaunchNode)element;
+ List<IModelNode> children = new ArrayList<IModelNode>();
+ if (LaunchNode.TYPE_ROOT.equals(node.getType())) {
+ if (isTypeNodeVisible()) {
+ // return all type nodes of the model
+ if (isEmptyTypeNodeVisible()) {
+ return node.getChildren();
+ }
+ // return only _not_ empty type nodes of the model
+ for (IModelNode typeNode : node.getChildren()) {
+ if (((IContainerModelNode)typeNode).hasChildren()) {
+ children.add(typeNode);
+ }
+ }
+ return children.toArray();
+ }
+ // return all config nodes of all type nodes of the model
+ for (IModelNode typeNode : node.getChildren()) {
+ for (IModelNode configNode : ((IContainerModelNode)typeNode).getChildren()) {
+ children.add(configNode);
+ }
+ }
+ return children.toArray();
+ }
+ return node.getChildren();
}
LaunchModel model = LaunchModel.getLaunchModel(element);
@@ -124,7 +158,7 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
if (isRootNodeVisible() && model.getRootNode().hasChildren()) {
return new Object[]{model.getRootNode()};
}
- return model.getRootNode().getChildren();
+ return getChildren(model.getRootNode());
}
return NO_ELEMENTS;
}
@@ -136,11 +170,39 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
@Override
public boolean hasChildren(Object element) {
if (element instanceof LaunchNode) {
+ LaunchNode node = (LaunchNode)element;
+ List<IModelNode> children = new ArrayList<IModelNode>();
+ if (LaunchNode.TYPE_ROOT.equals(node.getType())) {
+ if (isTypeNodeVisible()) {
+ // return all type nodes of the model
+ if (isEmptyTypeNodeVisible()) {
+ return ((LaunchNode)element).hasChildren();
+ }
+ // return only _not_ empty type nodes of the model
+ for (IModelNode typeNode : node.getChildren()) {
+ if (((IContainerModelNode)typeNode).hasChildren()) {
+ children.add(typeNode);
+ }
+ }
+ return !children.isEmpty();
+ }
+ // return all config nodes of all type nodes of the model
+ for (IModelNode typeNode : node.getChildren()) {
+ for (IModelNode configNode : ((IContainerModelNode)typeNode).getChildren()) {
+ children.add(configNode);
+ }
+ }
+ return !children.isEmpty();
+ }
return ((LaunchNode)element).hasChildren();
}
+
LaunchModel model = LaunchModel.getLaunchModel(element);
if (model != null) {
- return model.getRootNode().hasChildren();
+ if (isRootNodeVisible()) {
+ return true;
+ }
+ return hasChildren(model.getRootNode());
}
return false;
}
@@ -154,6 +216,24 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
return true;
}
+ /**
+ * If the launch config type node in the tree is visible.
+ *
+ * @return true if it is visible.
+ */
+ protected boolean isTypeNodeVisible() {
+ return true;
+ }
+
+ /**
+ * If an empty launch config type node in the tree is visible.
+ *
+ * @return true if it is visible.
+ */
+ protected boolean isEmptyTypeNodeVisible() {
+ return true;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
*/
@@ -161,12 +241,56 @@ public class LaunchNavigatorContentProvider extends TreeContentProvider implemen
public void eventFired(EventObject event) {
final TreeViewer viewer = this.viewer;
if (event.getSource() instanceof LaunchModel) {
+ final LaunchModel model = (LaunchModel)event.getSource();
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
- viewer.refresh(true);
+ viewer.refresh((isRootNodeVisible() ? model.getRootNode() : model.getModelRoot()), true);
}
});
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreePathContentProvider#getChildren(org.eclipse.jface.viewers.TreePath)
+ */
+ @Override
+ public Object[] getChildren(TreePath parentPath) {
+ return parentPath != null ? getChildren(parentPath.getLastSegment()) : NO_ELEMENTS;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreePathContentProvider#hasChildren(org.eclipse.jface.viewers.TreePath)
+ */
+ @Override
+ public boolean hasChildren(TreePath path) {
+ return path != null ? hasChildren(path.getLastSegment()) : false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreePathContentProvider#getParents(java.lang.Object)
+ */
+ @Override
+ public TreePath[] getParents(Object element) {
+ // Not sure if we ever have to calculate the _full_ tree path. The parent NavigatorContentServiceContentProvider
+ // is consuming only the last segment.
+ List<TreePath> pathes = new ArrayList<TreePath>();
+
+ Object parent = getParent(element);
+ TreePath parentPath = new TreePath(new Object[]{parent});
+ if (!(parent instanceof ICategory) && element instanceof LaunchNode && ((LaunchNode)element).getLaunchConfiguration() != null) {
+ if (Managers.getCategoryManager().belongsTo(IUIConstants.ID_CAT_FAVORITES, LaunchModel.getCategoryId(((LaunchNode)element).getLaunchConfiguration()))) {
+ // Get the "Favorites" category
+ ICategory favCategory = CategoriesExtensionPointManager.getInstance().getCategory(IUIConstants.ID_CAT_FAVORITES, false);
+ if (favCategory != null) {
+ pathes.add(new TreePath(new Object[]{favCategory}));
+ }
+ }
+ }
+ if (!pathes.contains(parentPath)) {
+ pathes.add(parentPath);
+ }
+
+ return pathes.toArray(new TreePath[pathes.size()]);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
index 183f29b..2549147 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchModel.java
@@ -12,17 +12,21 @@ package org.eclipse.tcf.te.launch.ui.model;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EventObject;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationListener;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.tcf.te.launch.core.bindings.LaunchConfigTypeBindingsManager;
import org.eclipse.tcf.te.launch.core.interfaces.IReferencedProjectItem;
+import org.eclipse.tcf.te.launch.core.lm.interfaces.ICommonLaunchAttributes;
+import org.eclipse.tcf.te.launch.core.persistence.DefaultPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate;
import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectItem;
import org.eclipse.tcf.te.launch.core.persistence.projects.ReferencedProjectsPersistenceDelegate;
@@ -31,15 +35,19 @@ import org.eclipse.tcf.te.launch.core.selection.ProjectSelectionContext;
import org.eclipse.tcf.te.launch.core.selection.RemoteSelectionContext;
import org.eclipse.tcf.te.runtime.events.ChangeEvent;
import org.eclipse.tcf.te.runtime.events.EventManager;
+import org.eclipse.tcf.te.runtime.interfaces.events.IEventListener;
import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
/**
* LaunchModel
*/
-public final class LaunchModel {
+public final class LaunchModel implements IEventListener, ILaunchConfigurationListener {
private static final Map<Object,LaunchModel> models = new HashMap<Object, LaunchModel>();
+ private static final Map<String,String> nameToUUID = new HashMap<String, String>();
/**
* Get the launch model of the rootNode.
@@ -49,12 +57,15 @@ public final class LaunchModel {
* @return The launch model.
*/
public static LaunchModel getLaunchModel(final Object modelRoot) {
- LaunchModel model = models.get(modelRoot);
- if (model == null) {
- model = new LaunchModel(modelRoot);
- models.put(modelRoot, model);
+ if (modelRoot instanceof ICategory || modelRoot instanceof IModelNode || modelRoot instanceof IProject) {
+ LaunchModel model = models.get(modelRoot);
+ if (model == null) {
+ model = new LaunchModel(modelRoot);
+ models.put(modelRoot, model);
+ }
+ return model;
}
- return model;
+ return null;
}
private final LaunchNode rootNode;
@@ -67,45 +78,97 @@ public final class LaunchModel {
this.modelRoot = modelRoot;
rootNode = new LaunchNode(this);
refresh();
- DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(new ILaunchConfigurationListener() {
- @Override
- public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- if (refresh()) {
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchRemoved", null, null)); //$NON-NLS-1$
- }
- }
+ DebugPlugin.getDefault().getLaunchManager().addLaunchConfigurationListener(this);
+
+ if (modelRoot instanceof ICategory) {
+ EventManager.getInstance().addEventListener(this, ChangeEvent.class);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void launchConfigurationRemoved(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ if (getModelRoot() instanceof ICategory) {
+ Managers.getCategoryManager().remove(((ICategory)getModelRoot()).getId(), getCategoryId(configuration));
+ nameToUUID.remove(configuration.getName());
}
- @Override
- public void launchConfigurationChanged(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- refresh();
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchChanged", null, null)); //$NON-NLS-1$
- }
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, ChangeEvent.ID_REMOVED, null, null));
}
- @Override
- public void launchConfigurationAdded(ILaunchConfiguration configuration) {
- if (!configuration.isWorkingCopy()) {
- if (refresh()) {
- EventManager.getInstance().fireEvent(new ChangeEvent(LaunchModel.this, "launchAdded", null, null)); //$NON-NLS-1$
- }
- }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void launchConfigurationChanged(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ refresh();
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, ChangeEvent.ID_CHANGED, null, null));
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ @Override
+ public void launchConfigurationAdded(ILaunchConfiguration configuration) {
+ if (!configuration.isWorkingCopy()) {
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, ChangeEvent.ID_ADDED, null, null));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.interfaces.events.IEventListener#eventFired(java.util.EventObject)
+ */
+ @Override
+ public void eventFired(EventObject event) {
+ Assert.isTrue(event instanceof ChangeEvent);
+ ChangeEvent e = (ChangeEvent)event;
+ if (e.getSource() instanceof ICategory &&
+ ((e.getNewValue() instanceof String && ((String)e.getNewValue()).startsWith(LaunchNode.class.getName())) ||
+ (e.getOldValue() instanceof String && ((String)e.getOldValue()).startsWith(LaunchNode.class.getName())))) {
+ if (refresh()) {
+ EventManager.getInstance().fireEvent(new ChangeEvent(this, ((ChangeEvent)event).getEventId(), null, null));
}
- });
+ }
}
+ /**
+ * Return the root node of the model tree.
+ */
public LaunchNode getRootNode() {
return rootNode;
}
+ /**
+ * Return the model root (IModelNode, IProject, ICategory).
+ */
public Object getModelRoot() {
return modelRoot;
}
+ /**
+ * Refresh the model.
+ * @return <code>true</code> if the model has changed.
+ */
public boolean refresh() {
boolean changed = false;
Object parent = rootNode.getModel().getModelRoot();
String[] typeIds = new String[0];
+ if (parent instanceof ICategory) {
+ List<String> ids = new ArrayList<String>();
+ for (ILaunchConfigurationType type : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes()) {
+ ids.add(type.getIdentifier());
+ }
+ typeIds = ids.toArray(new String[ids.size()]);
+ }
if (parent instanceof IProject) {
typeIds = LaunchConfigTypeBindingsManager.getInstance().getValidLaunchConfigTypes(
new LaunchSelection(null, new ProjectSelectionContext((IProject)parent, true)));
@@ -138,18 +201,15 @@ public final class LaunchModel {
List<IModelNode> configNodes = new ArrayList<IModelNode>(Arrays.asList(((IContainerModelNode)typeNode).getChildren()));
for (ILaunchConfiguration config : configs) {
- if (parent instanceof IModelNode) {
+ if (parent instanceof ICategory) {
+ if (Managers.getCategoryManager().belongsTo(((ICategory)parent).getId(), getCategoryId(config))) {
+ changed |= checkAndAdd(config, (IContainerModelNode)typeNode, configNodes);
+ }
+ }
+ else if (parent instanceof IModelNode) {
IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(config);
if (contexts == null || contexts.length == 0 || Arrays.asList(contexts).contains(parent)) {
- IModelNode configNode = find(config, configNodes);
- if (configNode != null) {
- configNodes.remove(configNode);
- }
- else {
- configNode = new LaunchNode(config);
- ((IContainerModelNode)typeNode).add(configNode);
- changed = true;
- }
+ changed |= checkAndAdd(config, (IContainerModelNode)typeNode, configNodes);
}
}
else if (parent instanceof IProject) {
@@ -157,15 +217,7 @@ public final class LaunchModel {
IReferencedProjectItem project = new ReferencedProjectItem();
project.setProperty(IReferencedProjectItem.PROPERTY_PROJECT_NAME, ((IProject)parent).getName());
if (projects != null && Arrays.asList(projects).contains(project)) {
- IModelNode configNode = find(config, configNodes);
- if (configNode != null) {
- configNodes.remove(configNode);
- }
- else {
- configNode = new LaunchNode(config);
- ((IContainerModelNode)typeNode).add(configNode);
- changed = true;
- }
+ changed |= checkAndAdd(config, (IContainerModelNode)typeNode, configNodes);
}
}
}
@@ -173,15 +225,31 @@ public final class LaunchModel {
((IContainerModelNode)typeNode).remove(configToDelete, true);
changed = true;
}
- }
- for (IModelNode typeToDelete : typeNodes) {
- rootNode.remove(typeToDelete, true);
- changed = true;
+ if (parent instanceof ICategory && typeNode.isEmpty()) {
+ typeNodes.add(typeNode);
+ }
}
}
+ for (IModelNode typeToDelete : typeNodes) {
+ rootNode.remove(typeToDelete, true);
+ changed = true;
+ }
return changed;
}
+ private boolean checkAndAdd(ILaunchConfiguration config, IContainerModelNode typeNode, List<IModelNode> configNodes) {
+ IModelNode configNode = find(config, configNodes);
+ if (configNode != null) {
+ configNodes.remove(configNode);
+ }
+ else {
+ configNode = new LaunchNode(config);
+ typeNode.add(configNode);
+ return true;
+ }
+ return false;
+ }
+
private IModelNode find(Object data, List<IModelNode> list) {
for (IModelNode candidate : list) {
if (candidate instanceof LaunchNode) {
@@ -194,4 +262,21 @@ public final class LaunchModel {
}
return null;
}
+
+ /**
+ * Get the unique category id for this launch config.
+ * @param config The launch configuration.
+ * @return The unique category id.
+ */
+ public static String getCategoryId(ILaunchConfiguration config) {
+ String uuid = DefaultPersistenceDelegate.getAttribute(config, ICommonLaunchAttributes.ATTR_UUID, (String)null);
+ if (uuid == null) {
+ uuid = nameToUUID.get(config.getName());
+ }
+ if (uuid != null && !nameToUUID.containsKey(config.getName())) {
+ nameToUUID.put(config.getName(), uuid);
+ }
+
+ return LaunchNode.class.getName() + "." + (uuid != null ? uuid : config.getName()); //$NON-NLS-1$
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
index 749a4ed..5e5bb5e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/model/LaunchNode.java
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.tcf.te.launch.core.lm.LaunchConfigHelper;
@@ -67,7 +66,6 @@ public class LaunchNode extends ContainerModelNode {
parent = parent.getParent();
}
- Assert.isNotNull(model);
return model;
}
@@ -79,7 +77,14 @@ public class LaunchNode extends ContainerModelNode {
}
public ILaunchConfigurationType getLaunchConfigurationType() {
- if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ if (getLaunchConfiguration() != null) {
+ try {
+ return getLaunchConfiguration().getType();
+ }
+ catch (Exception e) {
+ }
+ }
+ else if (TYPE_LAUNCH_CONFIG.equals(getType())) {
return ((LaunchNode)getParent()).getLaunchConfigurationType();
}
else if (TYPE_LAUNCH_CONFIG_TYPE.equals(getType())) {
@@ -123,6 +128,9 @@ public class LaunchNode extends ContainerModelNode {
public boolean isValidFor(String mode) {
if (TYPE_LAUNCH_CONFIG.equals(getType())) {
+ if (getLaunchConfigurationType() == null) {
+ return false;
+ }
List<String> modes;
if (mode != null && mode.trim().length() > 0) {
modes = new ArrayList<String>();
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/ChangeEvent.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/ChangeEvent.java
index 2d23895..9eb71e9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/ChangeEvent.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime/src/org/eclipse/tcf/te/runtime/events/ChangeEvent.java
@@ -1,117 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.runtime.events;
-
-import java.util.EventObject;
-
-import org.eclipse.tcf.te.runtime.activator.CoreBundleActivator;
-import org.eclipse.tcf.te.runtime.interfaces.tracing.ITraceIds;
-
-/**
- * Common change event implementation.
- */
-public class ChangeEvent extends EventObject {
- private static final long serialVersionUID = -7859159130977760588L;
-
- private Object eventId;
- private Object oldValue;
- private Object newValue;
-
- /**
- * Constructor.
- *
- * @param source The source object. Must not be <code>null</code>.
- * @param eventId The event id. Must not be <code>null</code>.
- * @param oldValue The old value.
- * @param newValue The new value.
- *
- * @exception IllegalArgumentException if eventId == null.
- */
- public ChangeEvent(Object source, Object eventId, Object oldValue, Object newValue) {
- super(source);
-
- if (eventId == null) throw new IllegalArgumentException("null eventId"); //$NON-NLS-1$
-
- this.eventId = eventId;
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
-
- /**
- * Returns the event id.
- *
- * @return The event id.
- */
- public final Object getEventId() {
- return eventId;
- }
-
- /**
- * Returns the old value.
- *
- * @return The old value or <code>null</code>.
- */
- public final Object getOldValue() {
- return oldValue;
- }
-
- /**
- * Returns the new value.
- *
- * @return The new value or <code>null</code>.
- */
- public final Object getNewValue() {
- return newValue;
- }
-
- /*
- * Formats a value due to its type.
- */
- private Object formatValue(Object value) {
- Object formattedValue = value;
- if (value != null && value.getClass().isArray()) {
- StringBuilder str = new StringBuilder();
- str.append("{"); //$NON-NLS-1$
- for (int i = 0; i < ((Object[]) value).length; i++) {
- if (i > 0) str.append(","); //$NON-NLS-1$
- str.append(formatValue(((Object[]) value)[i]));
- }
- str.append("}"); //$NON-NLS-1$
- formattedValue = str.toString();
- }
- return formattedValue;
- }
-
- /*
- * (non-Javadoc)
- * @see java.util.EventObject#toString()
- */
- @Override
- public String toString() {
- StringBuilder toString = new StringBuilder(getClass().getName());
-
- String prefix = ""; //$NON-NLS-1$
- // if tracing the event, formating them a little bit better readable.
- if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_EVENTS))
- prefix = "\n\t\t"; //$NON-NLS-1$
-
- toString.append(prefix + "{eventId="); //$NON-NLS-1$
- toString.append(eventId);
- toString.append("," + prefix + "source="); //$NON-NLS-1$ //$NON-NLS-2$
- toString.append(source);
- toString.append("," + prefix + "oldValue="); //$NON-NLS-1$ //$NON-NLS-2$
- toString.append(formatValue(oldValue));
- toString.append("," + prefix + "newValue="); //$NON-NLS-1$ //$NON-NLS-2$
- toString.append(formatValue(newValue));
- toString.append("}"); //$NON-NLS-1$
-
- return toString.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.runtime.events;
+
+import java.util.EventObject;
+
+import org.eclipse.tcf.te.runtime.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.runtime.interfaces.tracing.ITraceIds;
+
+/**
+ * Common change event implementation.
+ */
+public class ChangeEvent extends EventObject {
+ private static final long serialVersionUID = -7859159130977760588L;
+
+ public static final String ID_ADDED = "added"; //$NON-NLS-1$
+ public static final String ID_REMOVED = "removed"; //$NON-NLS-1$
+ public static final String ID_CHANGED = "changed"; //$NON-NLS-1$
+
+ private Object eventId;
+ private Object oldValue;
+ private Object newValue;
+
+ /**
+ * Constructor.
+ *
+ * @param source The source object. Must not be <code>null</code>.
+ * @param eventId The event id. Must not be <code>null</code>.
+ * @param oldValue The old value.
+ * @param newValue The new value.
+ *
+ * @exception IllegalArgumentException if eventId == null.
+ */
+ public ChangeEvent(Object source, Object eventId, Object oldValue, Object newValue) {
+ super(source);
+
+ if (eventId == null) {
+ throw new IllegalArgumentException("null eventId"); //$NON-NLS-1$
+ }
+
+ this.eventId = eventId;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+
+ /**
+ * Returns the event id.
+ *
+ * @return The event id.
+ */
+ public final Object getEventId() {
+ return eventId;
+ }
+
+ /**
+ * Returns the old value.
+ *
+ * @return The old value or <code>null</code>.
+ */
+ public final Object getOldValue() {
+ return oldValue;
+ }
+
+ /**
+ * Returns the new value.
+ *
+ * @return The new value or <code>null</code>.
+ */
+ public final Object getNewValue() {
+ return newValue;
+ }
+
+ /*
+ * Formats a value due to its type.
+ */
+ private Object formatValue(Object value) {
+ Object formattedValue = value;
+ if (value != null && value.getClass().isArray()) {
+ StringBuilder str = new StringBuilder();
+ str.append("{"); //$NON-NLS-1$
+ for (int i = 0; i < ((Object[]) value).length; i++) {
+ if (i > 0) {
+ str.append(","); //$NON-NLS-1$
+ }
+ str.append(formatValue(((Object[]) value)[i]));
+ }
+ str.append("}"); //$NON-NLS-1$
+ formattedValue = str.toString();
+ }
+ return formattedValue;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.EventObject#toString()
+ */
+ @Override
+ public String toString() {
+ StringBuilder toString = new StringBuilder(getClass().getName());
+
+ String prefix = ""; //$NON-NLS-1$
+ // if tracing the event, formating them a little bit better readable.
+ if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_EVENTS)) {
+ prefix = "\n\t\t"; //$NON-NLS-1$
+ }
+
+ toString.append(prefix + "{eventId="); //$NON-NLS-1$
+ toString.append(eventId);
+ toString.append("," + prefix + "source="); //$NON-NLS-1$ //$NON-NLS-2$
+ toString.append(source);
+ toString.append("," + prefix + "oldValue="); //$NON-NLS-1$ //$NON-NLS-2$
+ toString.append(formatValue(oldValue));
+ toString.append("," + prefix + "newValue="); //$NON-NLS-1$ //$NON-NLS-2$
+ toString.append(formatValue(newValue));
+ toString.append("}"); //$NON-NLS-1$
+
+ return toString.toString();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
index 548abf8..2d13bce 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/plugin.xml
@@ -1,486 +1,486 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Extension Points -->
- <extension-point id="editorPageBindings" name="%ExtensionPoint.editorPageBindings.name" schema="schema/editorPageBindings.exsd"/>
- <extension-point id="editorPages" name="%ExtensionPoint.editorPages.name" schema="schema/editorPages.exsd"/>
- <extension-point id="categories" name="%ExtensionPoint.categories.name" schema="schema/categories.exsd"/>
-
-<!-- Common Navigator contributions -->
- <extension point="org.eclipse.ui.navigator.viewer">
- <viewer
- helpContext="org.eclipse.tcf.te.ui.views.View"
- viewerId="org.eclipse.tcf.te.ui.views.View">
- <popupMenu
- id="org.eclipse.tcf.te.ui.views.View#Popup"
- allowsPlatformContributions="true">
- <insertionPoint name="group.new" separator="true"/>
- <insertionPoint name="group.goto"/>
- <insertionPoint name="group.expandto" separator="true"/>
- <insertionPoint name="group.expand"/>
- <insertionPoint name="group.open" separator="true"/>
- <insertionPoint name="group.openWith"/>
- <insertionPoint name="group.showIn"/>
- <insertionPoint name="group.connect" separator="true"/>
- <insertionPoint name="group.redirect" separator="true"/>
- <insertionPoint name="group.symbols" separator="true"/>
- <insertionPoint name="group.symbols.rd"/>
- <insertionPoint name="group.symbols.loadunload"/>
- <insertionPoint name="group.symbols.additions"/>
- <insertionPoint name="group.launch" separator="true"/>
- <insertionPoint name="group.launch.rundebug"/>
- <insertionPoint name="group.launch.modes"/>
- <insertionPoint name="group.launch.additions"/>
- <insertionPoint name="group.show" separator="true"/>
- <insertionPoint name="group.edit" separator="true"/>
- <insertionPoint name="group.delete"/>
- <insertionPoint name="group.build" separator="true"/>
- <insertionPoint name="group.refresh" separator="true"/>
- <insertionPoint name="group.syncop"/>
- <insertionPoint name="group.categories" separator="true"/>
- <insertionPoint name="group.reorganize"/>
- <insertionPoint name="group.reorder"/>
- <insertionPoint name="group.port"/>
- <insertionPoint name="group.generate" separator="true"/>
- <insertionPoint name="group.search" separator="true"/>
- <insertionPoint name="group.connection" separator="true"/>
- <insertionPoint name="group.operations" separator="true"/>
- <insertionPoint name="group.analysis" separator="true"/>
- <insertionPoint name="additions" separator="true"/>
- <insertionPoint name="group.properties" separator="true"/>
- </popupMenu>
- <options>
- <property
- name="org.eclipse.ui.navigator.hideLinkWithEditorAction"
- value="true">
- </property>
- <property
- name="org.eclipse.ui.navigator.hideAvailableCustomizationsDialog"
- value="true">
- </property>
- <property
- name="org.eclipse.ui.navigator.enforceHasChildren"
- value="true">
- </property>
- </options>
- </viewer>
-
- <viewerContentBinding viewerId="org.eclipse.tcf.te.ui.views.View">
- <includes>
- <contentExtension
- pattern="org.eclipse.tcf.te.ui.views.navigator.*">
- </contentExtension>
-
- </includes>
- </viewerContentBinding>
-
- <viewerActionBinding
- viewerId="org.eclipse.tcf.te.ui.views.View">
- <includes>
- <actionExtension
- pattern="org.eclipse.tcf.te.ui.views.navigator.actions.*">
- </actionExtension>
- </includes>
- </viewerActionBinding>
- </extension>
-
-<!-- Common navigator contributions -->
- <extension point="org.eclipse.ui.navigator.navigatorContent">
-
-<!-- Default navigator content contibutions -->
- <navigatorContent
- activeByDefault="true"
- appearsBefore="org.eclipse.tcf.te.tcf.ui.navigator.content"
- contentProvider="org.eclipse.tcf.te.ui.views.navigator.ContentProviderDelegate"
- icon="icons/eview16/targets_view.gif"
- id="org.eclipse.tcf.te.ui.views.navigator.content"
- labelProvider="org.eclipse.tcf.te.ui.views.navigator.LabelProviderDelegate"
- name="%navigatorContent.name"
- priority="higher">
- <triggerPoints>
- <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.IRoot"/>
- </triggerPoints>
- <possibleChildren>
- <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/>
- </possibleChildren>
- <commonSorter
- class="org.eclipse.tcf.te.ui.views.navigator.ViewerSorter"
- id="org.eclipse.tcf.te.ui.views.navigator.sorter"/>
- </navigatorContent>
-
-<!-- Default navigator action contributions -->
- <actionProvider
- class="org.eclipse.tcf.te.ui.views.actions.NewActionProvider"
- id="org.eclipse.tcf.te.ui.views.navigator.actions.NewActionProvider">
- <enablement>
- </enablement>
- </actionProvider>
-
- <actionProvider
- class="org.eclipse.tcf.te.ui.views.actions.GoIntoActionProvider"
- id="org.eclipse.tcf.te.ui.views.navigator.actions.GoIntoActionProvider">
- <enablement></enablement>
- </actionProvider>
-
- </extension>
-
-<!-- View contributions -->
- <extension point="org.eclipse.ui.views">
- <category
- id="org.eclipse.tcf.te.ui.views.category"
- name="%ViewCategory.name">
- </category>
- <view
- category="org.eclipse.tcf.te.ui.views.category"
- class="org.eclipse.tcf.te.ui.views.internal.View"
- icon="icons/eview16/targets_view.gif"
- id="org.eclipse.tcf.te.ui.views.View"
- name="%View.name"
- restorable="true">
- </view>
- </extension>
-
-<!-- View categories contributions -->
- <extension point="org.eclipse.tcf.te.ui.views.categories">
- <category
- class="org.eclipse.tcf.te.ui.views.categories.Category"
- icon="icons/obj16/favorites.gif"
- id="org.eclipse.tcf.te.ui.views.category.favorites"
- label="%category.favorites.name"
- rank="1">
- </category>
-
- <category
- class="org.eclipse.tcf.te.ui.views.categories.Category"
- icon="icons/obj16/targets.gif"
- id="org.eclipse.tcf.te.ui.views.category.mytargets"
- label="%category.mytargets.name"
- rank="10">
- </category>
-
- <category
- class="org.eclipse.tcf.te.ui.views.categories.Category"
- icon="icons/obj16/neighborhood.gif"
- id="org.eclipse.tcf.te.ui.views.category.neighborhood"
- label="%category.neighborhood.name"
- rank="20">
- </category>
- </extension>
-
-<!-- Perspective -->
- <extension point="org.eclipse.ui.perspectives">
- <perspective
- class="org.eclipse.tcf.te.ui.views.perspective.PerspectiveFactory"
- icon="icons/eview16/editor.gif"
- id="org.eclipse.tcf.te.ui.perspective"
- name="%Perspective.name">
- </perspective>
- </extension>
-
-<!-- Perspective contributions -->
- <extension point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension targetID="org.eclipse.tcf.te.ui.perspective">
- <!-- Run/Debug actions should be available -->
- <actionSet id="org.eclipse.debug.ui.launchActionSet"/>
- <!-- Register the view shortcuts -->
- <viewShortcut id="org.eclipse.tcf.te.ui.views.View"/>
- </perspectiveExtension>
- </extension>
-
-<!-- Editor contributions -->
- <extension point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.tcf.te.ui.views.editor.Editor"
- default="false"
- icon="icons/eview16/prop_ps.gif"
- id="org.eclipse.tcf.te.ui.views.Editor"
- name="%Editor.name">
- </editor>
- </extension>
-
-<!-- Tabbed properties view contributions -->
- <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
- <propertyContributor
- contributorId="org.eclipse.tcf.te.ui"
- labelProvider="org.eclipse.tcf.te.ui.views.internal.PropertyContributorLabelProvider">
- <propertyCategory category="org.eclipse.tcf.te"/>
- </propertyContributor>
- </extension>
-
-<!-- Menu contributions -->
- <extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.properties">
- <command
- commandId="org.eclipse.ui.file.properties"
- helpContextId="org.eclipse.tcf.te.ui.views.command_Properties"
- id="properties"
- label="%command.properties.label"
- mnemonic="r"
- tooltip="%command.properties.tooltip">
- <visibleWhen>
- <with variable="selection">
- <count value="1"/>
- <iterate operator="and" ifEmpty="false">
- <test property="org.eclipse.tcf.te.ui.views.hasApplicableEditorBindings" value="true"/>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.showIn">
- <menu
- commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
- id="org.eclipse.tcf.te.ui.views.View.showIn"
- label="%menu.showIn.label">
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
- icon="icons/eview16/prop_ps.gif"
- label="%menu.properties.label"
- style="push">
- <visibleWhen checkEnabled="true"/>
- </command>
- <visibleWhen checkEnabled="true"/>
- </menu>
- </menuContribution>
-
- <menuContribution locationURI="menu:org.eclipse.tcf.te.ui.views.View?after=additions">
- <separator
- name="group.filters"
- visible="true">
- </separator>
- <dynamic
- class="org.eclipse.tcf.te.ui.views.handler.FilterMRUContribution"
- id="org.eclipse.tcf.te.ui.views.dynamic.filterMRU">
- </dynamic>
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.filters"
- icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/filter_ps.gif"
- id="org.eclipse.tcf.te.ui.views.command.filters"
- label="%command.filters.label"
- style="push">
- </command>
- <separator
- name="group.content"
- visible="true">
- </separator>
- <dynamic
- class="org.eclipse.tcf.te.ui.views.handler.ContentMRUContribution"
- id="org.eclipse.tcf.te.ui.views.dynamic.contentMRU">
- </dynamic>
- <command
- commandId="org.eclipse.tcf.te.ui.views.command.content"
- icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/content.gif"
- id="org.eclipse.tcf.te.ui.views.command.content"
- label="%command.content.label"
- style="push">
- </command>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.categories">
- <menu
- id="org.eclipse.tcf.te.ui.views.menu.categories.add"
- label="%menu.categories.addto.label">
- <dynamic
- id="org.eclipse.tcf.te.ui.views.dynamic.categories.add.multi"
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryAddToContributionItem">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="(1-"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
- </iterate>
- </with>
- </visibleWhen>
- </dynamic>
- </menu>
-
- <dynamic
- id="org.eclipse.tcf.te.ui.views.dynamic.categories.add.single"
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryAddToContributionItem">
- <visibleWhen checkEnabled="false">
- <with variable="selection">
- <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="1"/>
- <iterate operator="and" ifEmpty="false">
- <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
- </iterate>
- </with>
- </visibleWhen>
- </dynamic>
- </menuContribution>
-
- </extension>
-
-<!-- Command contributions -->
- <extension point="org.eclipse.ui.commands">
- <!-- Definition of the Common Navigator global retargetable open
- action id as command.
- -->
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.ui.navigator.Open"
- id="org.eclipse.ui.navigator.Open"
- name="%command.open.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.views.command_ShowInGroup"
- id="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
- name="%command.showin.name">
- </command>
-
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.views.command_ShowInProperties"
- id="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
- name="%command.showInProperties.label">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.views.command_Filters"
- id="org.eclipse.tcf.te.ui.views.command.filters"
- name="%command.filters.name">
- </command>
- <command
- categoryId="org.eclipse.tcf.te.ui.commands.category"
- helpContextId="org.eclipse.tcf.te.ui.views.command_Content"
- id="org.eclipse.tcf.te.ui.views.command.content"
- name="%command.content.name">
- </command>
- </extension>
-
-<!-- Handler contributions -->
- <extension point="org.eclipse.ui.handlers">
- <handler
- commandId="org.eclipse.ui.file.properties"
- class="org.eclipse.tcf.te.ui.views.handler.PropertiesCommandHandler">
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- </with>
- </enabledWhen>
- <activeWhen>
- <and>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- </with>
- <with variable="selection">
- <iterate operator="and" ifEmpty="false">
- <test property="org.eclipse.tcf.te.ui.views.hasApplicableEditorBindings" value="true"/>
- </iterate>
- </with>
- </and>
- </activeWhen>
- </handler>
-
- <handler
- commandId="org.eclipse.ui.navigator.Open"
- class="org.eclipse.tcf.te.ui.views.handler.OpenCommandHandler">
- <enabledWhen>
- <with variable="selection">
- <count value="1"/>
- </with>
- </enabledWhen>
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- </with>
- </activeWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.ui.views.handler.ShowInPropertiesHandler"
- commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties">
- <activeWhen>
- <with variable="activePartId">
- <equals value="org.eclipse.tcf.te.ui.views.View"/>
- </with>
- </activeWhen>
- </handler>
-
- <handler
- class="org.eclipse.tcf.te.ui.views.handler.ConfigFiltersHandler"
- commandId="org.eclipse.tcf.te.ui.views.command.filters">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="org.eclipse.tcf.te.ui.views.handler.ConfigContentHandler"
- commandId="org.eclipse.tcf.te.ui.views.command.content">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="org.eclipse.tcf.te.ui.views.View">
- </equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
-
-<!-- Eclipse core expressions property tester -->
- <extension point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tcf.te.ui.views.expressions.PropertyTester"
- id="org.eclipse.tcf.te.ui.views.PropertyTester"
- namespace="org.eclipse.tcf.te.ui.views"
- properties="hasApplicableEditorBindings"
- type="java.lang.Object">
- </propertyTester>
-
- <propertyTester
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
- id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
- namespace="org.eclipse.tcf.te.ui.views"
- properties="isCategoryID,belongsTo"
- type="org.eclipse.tcf.te.ui.views.interfaces.ICategory">
- </propertyTester>
-
- <propertyTester
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
- id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
- namespace="org.eclipse.tcf.te.ui.views"
- properties="belongsTo"
- type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable">
- </propertyTester>
-
- <propertyTester
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
- id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
- namespace="org.eclipse.tcf.te.ui.views"
- properties="parentCategoryId,validAddToCategoriesCount"
- type="org.eclipse.jface.viewers.ISelection">
- </propertyTester>
-
- </extension>
-
-<!-- Preference contributions -->
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer class="org.eclipse.tcf.te.ui.views.internal.preferences.PreferencesInitializer"/>
- </extension>
-
-<!-- Element factory contributions -->
- <extension point="org.eclipse.ui.elementFactories">
- <factory
- class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryFactory"
- id="org.eclipse.tcf.te.ui.views.categoryFactory">
- </factory>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
- contextId="org.eclipse.tcf.te.ui.views.View"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M3+M2+W">
- </key>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Extension Points -->
+ <extension-point id="editorPageBindings" name="%ExtensionPoint.editorPageBindings.name" schema="schema/editorPageBindings.exsd"/>
+ <extension-point id="editorPages" name="%ExtensionPoint.editorPages.name" schema="schema/editorPages.exsd"/>
+ <extension-point id="categories" name="%ExtensionPoint.categories.name" schema="schema/categories.exsd"/>
+
+<!-- Common Navigator contributions -->
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <viewer
+ helpContext="org.eclipse.tcf.te.ui.views.View"
+ viewerId="org.eclipse.tcf.te.ui.views.View">
+ <popupMenu
+ id="org.eclipse.tcf.te.ui.views.View#Popup"
+ allowsPlatformContributions="true">
+ <insertionPoint name="group.new" separator="true"/>
+ <insertionPoint name="group.goto"/>
+ <insertionPoint name="group.expandto" separator="true"/>
+ <insertionPoint name="group.expand"/>
+ <insertionPoint name="group.open" separator="true"/>
+ <insertionPoint name="group.openWith"/>
+ <insertionPoint name="group.showIn"/>
+ <insertionPoint name="group.connect" separator="true"/>
+ <insertionPoint name="group.redirect" separator="true"/>
+ <insertionPoint name="group.symbols" separator="true"/>
+ <insertionPoint name="group.symbols.rd"/>
+ <insertionPoint name="group.symbols.loadunload"/>
+ <insertionPoint name="group.symbols.additions"/>
+ <insertionPoint name="group.launch" separator="true"/>
+ <insertionPoint name="group.launch.rundebug"/>
+ <insertionPoint name="group.launch.modes"/>
+ <insertionPoint name="group.launch.additions"/>
+ <insertionPoint name="group.show" separator="true"/>
+ <insertionPoint name="group.edit" separator="true"/>
+ <insertionPoint name="group.delete"/>
+ <insertionPoint name="group.build" separator="true"/>
+ <insertionPoint name="group.refresh" separator="true"/>
+ <insertionPoint name="group.syncop"/>
+ <insertionPoint name="group.categories" separator="true"/>
+ <insertionPoint name="group.reorganize"/>
+ <insertionPoint name="group.reorder"/>
+ <insertionPoint name="group.port"/>
+ <insertionPoint name="group.generate" separator="true"/>
+ <insertionPoint name="group.search" separator="true"/>
+ <insertionPoint name="group.connection" separator="true"/>
+ <insertionPoint name="group.operations" separator="true"/>
+ <insertionPoint name="group.analysis" separator="true"/>
+ <insertionPoint name="additions" separator="true"/>
+ <insertionPoint name="group.properties" separator="true"/>
+ </popupMenu>
+ <options>
+ <property
+ name="org.eclipse.ui.navigator.hideLinkWithEditorAction"
+ value="true">
+ </property>
+ <property
+ name="org.eclipse.ui.navigator.hideAvailableCustomizationsDialog"
+ value="true">
+ </property>
+ <property
+ name="org.eclipse.ui.navigator.enforceHasChildren"
+ value="true">
+ </property>
+ </options>
+ </viewer>
+
+ <viewerContentBinding viewerId="org.eclipse.tcf.te.ui.views.View">
+ <includes>
+ <contentExtension
+ pattern="org.eclipse.tcf.te.ui.views.navigator.*">
+ </contentExtension>
+
+ </includes>
+ </viewerContentBinding>
+
+ <viewerActionBinding
+ viewerId="org.eclipse.tcf.te.ui.views.View">
+ <includes>
+ <actionExtension
+ pattern="org.eclipse.tcf.te.ui.views.navigator.actions.*">
+ </actionExtension>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+
+<!-- Common navigator contributions -->
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+
+<!-- Default navigator content contibutions -->
+ <navigatorContent
+ activeByDefault="true"
+ appearsBefore="org.eclipse.tcf.te.tcf.ui.navigator.content"
+ contentProvider="org.eclipse.tcf.te.ui.views.navigator.ContentProviderDelegate"
+ icon="icons/eview16/targets_view.gif"
+ id="org.eclipse.tcf.te.ui.views.navigator.content"
+ labelProvider="org.eclipse.tcf.te.ui.views.navigator.LabelProviderDelegate"
+ name="%navigatorContent.name"
+ priority="higher">
+ <triggerPoints>
+ <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.IRoot"/>
+ </triggerPoints>
+ <possibleChildren>
+ <instanceof value="org.eclipse.tcf.te.ui.views.interfaces.ICategory"/>
+ </possibleChildren>
+ <commonSorter
+ class="org.eclipse.tcf.te.ui.views.navigator.ViewerSorter"
+ id="org.eclipse.tcf.te.ui.views.navigator.sorter"/>
+ </navigatorContent>
+
+<!-- Default navigator action contributions -->
+ <actionProvider
+ class="org.eclipse.tcf.te.ui.views.actions.NewActionProvider"
+ id="org.eclipse.tcf.te.ui.views.navigator.actions.NewActionProvider">
+ <enablement>
+ </enablement>
+ </actionProvider>
+
+ <actionProvider
+ class="org.eclipse.tcf.te.ui.views.actions.GoIntoActionProvider"
+ id="org.eclipse.tcf.te.ui.views.navigator.actions.GoIntoActionProvider">
+ <enablement></enablement>
+ </actionProvider>
+
+ </extension>
+
+<!-- View contributions -->
+ <extension point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.tcf.te.ui.views.category"
+ name="%ViewCategory.name">
+ </category>
+ <view
+ category="org.eclipse.tcf.te.ui.views.category"
+ class="org.eclipse.tcf.te.ui.views.internal.View"
+ icon="icons/eview16/targets_view.gif"
+ id="org.eclipse.tcf.te.ui.views.View"
+ name="%View.name"
+ restorable="true">
+ </view>
+ </extension>
+
+<!-- View categories contributions -->
+ <extension point="org.eclipse.tcf.te.ui.views.categories">
+ <category
+ class="org.eclipse.tcf.te.ui.views.categories.Category"
+ icon="icons/obj16/favorites.gif"
+ id="org.eclipse.tcf.te.ui.views.category.favorites"
+ label="%category.favorites.name"
+ rank="1">
+ </category>
+
+ <category
+ class="org.eclipse.tcf.te.ui.views.categories.Category"
+ icon="icons/obj16/targets.gif"
+ id="org.eclipse.tcf.te.ui.views.category.mytargets"
+ label="%category.mytargets.name"
+ rank="10">
+ </category>
+
+ <category
+ class="org.eclipse.tcf.te.ui.views.categories.Category"
+ icon="icons/obj16/neighborhood.gif"
+ id="org.eclipse.tcf.te.ui.views.category.neighborhood"
+ label="%category.neighborhood.name"
+ rank="20">
+ </category>
+ </extension>
+
+<!-- Perspective -->
+ <extension point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.eclipse.tcf.te.ui.views.perspective.PerspectiveFactory"
+ icon="icons/eview16/editor.gif"
+ id="org.eclipse.tcf.te.ui.perspective"
+ name="%Perspective.name">
+ </perspective>
+ </extension>
+
+<!-- Perspective contributions -->
+ <extension point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension targetID="org.eclipse.tcf.te.ui.perspective">
+ <!-- Run/Debug actions should be available -->
+ <actionSet id="org.eclipse.debug.ui.launchActionSet"/>
+ <!-- Register the view shortcuts -->
+ <viewShortcut id="org.eclipse.tcf.te.ui.views.View"/>
+ </perspectiveExtension>
+ </extension>
+
+<!-- Editor contributions -->
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.tcf.te.ui.views.editor.Editor"
+ default="false"
+ icon="icons/eview16/prop_ps.gif"
+ id="org.eclipse.tcf.te.ui.views.Editor"
+ name="%Editor.name">
+ </editor>
+ </extension>
+
+<!-- Tabbed properties view contributions -->
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <propertyContributor
+ contributorId="org.eclipse.tcf.te.ui"
+ labelProvider="org.eclipse.tcf.te.ui.views.internal.PropertyContributorLabelProvider">
+ <propertyCategory category="org.eclipse.tcf.te"/>
+ </propertyContributor>
+ </extension>
+
+<!-- Menu contributions -->
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.properties">
+ <command
+ commandId="org.eclipse.ui.file.properties"
+ helpContextId="org.eclipse.tcf.te.ui.views.command_Properties"
+ id="properties"
+ label="%command.properties.label"
+ mnemonic="r"
+ tooltip="%command.properties.tooltip">
+ <visibleWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <test property="org.eclipse.tcf.te.ui.views.hasApplicableEditorBindings" value="true"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.showIn">
+ <menu
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
+ id="org.eclipse.tcf.te.ui.views.View.showIn"
+ label="%menu.showIn.label">
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
+ icon="icons/eview16/prop_ps.gif"
+ label="%menu.properties.label"
+ style="push">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ <visibleWhen checkEnabled="true"/>
+ </menu>
+ </menuContribution>
+
+ <menuContribution locationURI="menu:org.eclipse.tcf.te.ui.views.View?after=additions">
+ <separator
+ name="group.filters"
+ visible="true">
+ </separator>
+ <dynamic
+ class="org.eclipse.tcf.te.ui.views.handler.FilterMRUContribution"
+ id="org.eclipse.tcf.te.ui.views.dynamic.filterMRU">
+ </dynamic>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.filters"
+ icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/filter_ps.gif"
+ id="org.eclipse.tcf.te.ui.views.command.filters"
+ label="%command.filters.label"
+ style="push">
+ </command>
+ <separator
+ name="group.content"
+ visible="true">
+ </separator>
+ <dynamic
+ class="org.eclipse.tcf.te.ui.views.handler.ContentMRUContribution"
+ id="org.eclipse.tcf.te.ui.views.dynamic.contentMRU">
+ </dynamic>
+ <command
+ commandId="org.eclipse.tcf.te.ui.views.command.content"
+ icon="platform:/plugin/org.eclipse.ui.navigator/icons/full/elcl16/content.gif"
+ id="org.eclipse.tcf.te.ui.views.command.content"
+ label="%command.content.label"
+ style="push">
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.tcf.te.ui.views.View#Popup?after=group.categories">
+ <menu
+ id="org.eclipse.tcf.te.ui.views.menu.categories.add"
+ label="%menu.categories.addto.label">
+ <dynamic
+ id="org.eclipse.tcf.te.ui.views.dynamic.categories.add.multi"
+ class="org.eclipse.tcf.te.ui.views.handler.CategoryAddToContributionItem">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="(1-"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ </menu>
+
+ <dynamic
+ id="org.eclipse.tcf.te.ui.views.dynamic.categories.add.single"
+ class="org.eclipse.tcf.te.ui.views.handler.CategoryAddToContributionItem">
+ <visibleWhen checkEnabled="false">
+ <with variable="selection">
+ <test property="org.eclipse.tcf.te.ui.views.validAddToCategoriesCount" value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <adapt type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </dynamic>
+ </menuContribution>
+
+ </extension>
+
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <!-- Definition of the Common Navigator global retargetable open
+ action id as command.
+ -->
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.ui.navigator.Open"
+ id="org.eclipse.ui.navigator.Open"
+ name="%command.open.name">
+ </command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.views.command_ShowInGroup"
+ id="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
+ name="%command.showin.name">
+ </command>
+
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.views.command_ShowInProperties"
+ id="org.eclipse.tcf.te.ui.views.command.ShowInProperties"
+ name="%command.showInProperties.label">
+ </command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.views.command_Filters"
+ id="org.eclipse.tcf.te.ui.views.command.filters"
+ name="%command.filters.name">
+ </command>
+ <command
+ categoryId="org.eclipse.tcf.te.ui.commands.category"
+ helpContextId="org.eclipse.tcf.te.ui.views.command_Content"
+ id="org.eclipse.tcf.te.ui.views.command.content"
+ name="%command.content.name">
+ </command>
+ </extension>
+
+<!-- Handler contributions -->
+ <extension point="org.eclipse.ui.handlers">
+ <handler
+ commandId="org.eclipse.ui.file.properties"
+ class="org.eclipse.tcf.te.ui.views.handler.PropertiesCommandHandler">
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ </with>
+ </enabledWhen>
+ <activeWhen>
+ <and>
+ <with variable="activePartId">
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ </with>
+ <with variable="selection">
+ <iterate operator="and" ifEmpty="false">
+ <test property="org.eclipse.tcf.te.ui.views.hasApplicableEditorBindings" value="true"/>
+ </iterate>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+
+ <handler
+ commandId="org.eclipse.ui.navigator.Open"
+ class="org.eclipse.tcf.te.ui.views.handler.OpenCommandHandler">
+ <enabledWhen>
+ <with variable="selection">
+ <count value="1"/>
+ </with>
+ </enabledWhen>
+ <activeWhen>
+ <with variable="activePartId">
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ </with>
+ </activeWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.ui.views.handler.ShowInPropertiesHandler"
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInProperties">
+ <activeWhen>
+ <with variable="activePartId">
+ <equals value="org.eclipse.tcf.te.ui.views.View"/>
+ </with>
+ </activeWhen>
+ </handler>
+
+ <handler
+ class="org.eclipse.tcf.te.ui.views.handler.ConfigFiltersHandler"
+ commandId="org.eclipse.tcf.te.ui.views.command.filters">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ class="org.eclipse.tcf.te.ui.views.handler.ConfigContentHandler"
+ commandId="org.eclipse.tcf.te.ui.views.command.content">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.tcf.te.ui.views.View">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+
+<!-- Eclipse core expressions property tester -->
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.tcf.te.ui.views.expressions.PropertyTester"
+ id="org.eclipse.tcf.te.ui.views.PropertyTester"
+ namespace="org.eclipse.tcf.te.ui.views"
+ properties="hasApplicableEditorBindings"
+ type="java.lang.Object">
+ </propertyTester>
+
+ <propertyTester
+ class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
+ id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
+ namespace="org.eclipse.tcf.te.ui.views"
+ properties="isCategoryID,belongsTo"
+ type="org.eclipse.tcf.te.ui.views.interfaces.ICategory">
+ </propertyTester>
+
+ <propertyTester
+ class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
+ id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
+ namespace="org.eclipse.tcf.te.ui.views"
+ properties="belongsTo"
+ type="org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable">
+ </propertyTester>
+
+ <propertyTester
+ class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryPropertyTester"
+ id="org.eclipse.tcf.te.ui.views.categories.CategoryPropertyTester"
+ namespace="org.eclipse.tcf.te.ui.views"
+ properties="parentCategoryId,validAddToCategoriesCount"
+ type="org.eclipse.jface.viewers.ISelection">
+ </propertyTester>
+
+ </extension>
+
+<!-- Preference contributions -->
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.eclipse.tcf.te.ui.views.internal.preferences.PreferencesInitializer"/>
+ </extension>
+
+<!-- Element factory contributions -->
+ <extension point="org.eclipse.ui.elementFactories">
+ <factory
+ class="org.eclipse.tcf.te.ui.views.internal.categories.CategoryFactory"
+ id="org.eclipse.tcf.te.ui.views.categoryFactory">
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.tcf.te.ui.views.command.ShowInGroup"
+ contextId="org.eclipse.tcf.te.ui.views.View"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M3+M2+W">
+ </key>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/CategoryAddToContributionItem.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/CategoryAddToContributionItem.java
new file mode 100644
index 0000000..1246ddc
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/handler/CategoryAddToContributionItem.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.handler;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
+import org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem;
+import org.eclipse.tcf.te.ui.views.nls.Messages;
+
+
+/**
+ * Dynamic menu contribution: Add To &lt;Category&gt;
+ */
+public class CategoryAddToContributionItem extends AbstractCategoryContributionItem {
+
+ /**
+ * Category action implementation.
+ */
+ protected static class AddToCategoryAction extends AbstractCategoryAction {
+
+ /**
+ * Constructor.
+ *
+ * @param item The parent contribution item. Must not be <code>null</code>:
+ * @param selection The selection. Must not be <code>null</code>.
+ * @param category The category. Must not be <code>null</code>.
+ * @param single <code>True</code> if the action is the only item added, <code>false</code> otherwise.
+ */
+ public AddToCategoryAction(AbstractCategoryContributionItem item, ISelection selection, ICategory category, boolean single) {
+ super(item, selection, category, single);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem.AbstractCategoryAction#makeSingleText(java.lang.String)
+ */
+ @Override
+ protected String makeSingleText(String text) {
+ Assert.isNotNull(text);
+ return NLS.bind(Messages.AddToCategoryAction_single_text, text);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem.AbstractCategoryAction#execute(java.lang.Object, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
+ */
+ @Override
+ protected boolean execute(Object element, ICategory category) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(category);
+
+ boolean refresh = false;
+
+ ICategorizable categorizable = getCategorizable(element);
+ Assert.isNotNull(categorizable);
+
+ if (!Managers.getCategoryManager().belongsTo(category.getId(), categorizable.getId())) {
+ Managers.getCategoryManager().add(category.getId(), categorizable.getId());
+ refresh = true;
+ }
+
+ return refresh;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#createAction(org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem, org.eclipse.jface.viewers.ISelection, org.eclipse.tcf.te.ui.views.interfaces.ICategory, boolean)
+ */
+ @Override
+ protected IAction createAction(AbstractCategoryContributionItem item, ISelection selection, ICategory category, boolean single) {
+ return new AddToCategoryAction(item, selection, category, single);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#isValid(org.eclipse.tcf.te.ui.views.interfaces.ICategory, java.lang.Object, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
+ */
+ @Override
+ protected boolean isValid(ICategory parentCategory, Object element, ICategory category) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(category);
+
+ // Delegate to the categorizable element
+ ICategorizable categorizable = getCategorizable(element);
+ Assert.isNotNull(categorizable);
+
+ return categorizable.isValid(ICategorizable.OPERATION.ADD, parentCategory, category);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#isEnabled(org.eclipse.jface.viewers.ISelection, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
+ */
+ @Override
+ protected boolean isEnabled(ISelection selection, ICategory category) {
+ Assert.isNotNull(selection);
+ Assert.isNotNull(category);
+
+ boolean enabled = false;
+
+ if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
+ enabled = true;
+ Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
+ while (iterator.hasNext()) {
+ Object element = iterator.next();
+
+ // Delegate to the categorizable element
+ ICategorizable categorizable = getCategorizable(element);
+ Assert.isNotNull(categorizable);
+ enabled &= categorizable.isEnabled(ICategorizable.OPERATION.ADD, category);
+ if (!enabled) {
+ break;
+ }
+ }
+ }
+
+ return enabled;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryAddToContributionItem.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryAddToContributionItem.java
deleted file mode 100644
index 53b2aba..0000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryAddToContributionItem.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems, Inc. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.views.internal.categories;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.ui.views.Managers;
-import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
-import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
-import org.eclipse.tcf.te.ui.views.nls.Messages;
-
-
-/**
- * Dynamic menu contribution: Add To &lt;Category&gt;
- */
-public class CategoryAddToContributionItem extends AbstractCategoryContributionItem {
-
- /**
- * Category action implementation.
- */
- protected static class AddToCategoryAction extends AbstractCategoryAction {
-
- /**
- * Constructor.
- *
- * @param item The parent contribution item. Must not be <code>null</code>:
- * @param selection The selection. Must not be <code>null</code>.
- * @param category The category. Must not be <code>null</code>.
- * @param single <code>True</code> if the action is the only item added, <code>false</code> otherwise.
- */
- public AddToCategoryAction(AbstractCategoryContributionItem item, ISelection selection, ICategory category, boolean single) {
- super(item, selection, category, single);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem.AbstractCategoryAction#makeSingleText(java.lang.String)
- */
- @Override
- protected String makeSingleText(String text) {
- Assert.isNotNull(text);
- return NLS.bind(Messages.AddToCategoryAction_single_text, text);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem.AbstractCategoryAction#execute(java.lang.Object, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
- */
- @Override
- protected boolean execute(Object element, ICategory category) {
- Assert.isNotNull(element);
- Assert.isNotNull(category);
-
- boolean refresh = false;
-
- ICategorizable categorizable = getCategorizable(element);
- Assert.isNotNull(categorizable);
-
- if (!Managers.getCategoryManager().belongsTo(category.getId(), categorizable.getId())) {
- Managers.getCategoryManager().add(category.getId(), categorizable.getId());
- refresh = true;
- }
-
- return refresh;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#createAction(org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem, org.eclipse.jface.viewers.ISelection, org.eclipse.tcf.te.ui.views.interfaces.ICategory, boolean)
- */
- @Override
- protected IAction createAction(AbstractCategoryContributionItem item, ISelection selection, ICategory category, boolean single) {
- return new AddToCategoryAction(item, selection, category, single);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#isValid(org.eclipse.tcf.te.ui.views.interfaces.ICategory, java.lang.Object, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
- */
- @Override
- protected boolean isValid(ICategory parentCategory, Object element, ICategory category) {
- Assert.isNotNull(element);
- Assert.isNotNull(category);
-
- // Delegate to the categorizable element
- ICategorizable categorizable = getCategorizable(element);
- Assert.isNotNull(categorizable);
-
- return categorizable.isValid(ICategorizable.OPERATION.ADD, parentCategory, category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.views.internal.categories.AbstractCategoryContributionItem#isEnabled(org.eclipse.jface.viewers.ISelection, org.eclipse.tcf.te.ui.views.interfaces.ICategory)
- */
- @Override
- protected boolean isEnabled(ISelection selection, ICategory category) {
- Assert.isNotNull(selection);
- Assert.isNotNull(category);
-
- boolean enabled = false;
-
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- enabled = true;
- Iterator<?> iterator = ((IStructuredSelection)selection).iterator();
- while (iterator.hasNext()) {
- Object element = iterator.next();
-
- // Delegate to the categorizable element
- ICategorizable categorizable = getCategorizable(element);
- Assert.isNotNull(categorizable);
- enabled &= categorizable.isEnabled(ICategorizable.OPERATION.ADD, category);
- if (!enabled) break;
- }
- }
-
- return enabled;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java
index 347254a..af6bc7a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryManager.java
@@ -25,7 +25,10 @@ import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.tcf.te.runtime.events.ChangeEvent;
+import org.eclipse.tcf.te.runtime.events.EventManager;
import org.eclipse.tcf.te.ui.views.activator.UIPlugin;
+import org.eclipse.tcf.te.ui.views.extensions.CategoriesExtensionPointManager;
import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategoryManager;
import com.google.gson.Gson;
@@ -86,7 +89,9 @@ public class CategoryManager implements ICategoryManager {
*/
private void initialize() {
IPath root = getRoot();
- if (root == null) return;
+ if (root == null) {
+ return;
+ }
// Clear out the transient maps
_t_cat2id.clear();
@@ -104,7 +109,9 @@ public class CategoryManager implements ICategoryManager {
reader = new InputStreamReader(new FileInputStream(file), "UTF-8"); //$NON-NLS-1$
cat2id.putAll(gson.fromJson(reader, Map.class));
} finally {
- if (reader != null) reader.close();
+ if (reader != null) {
+ reader.close();
+ }
}
} catch (IOException e) {
/* ignored on purpose */
@@ -119,7 +126,9 @@ public class CategoryManager implements ICategoryManager {
reader = new InputStreamReader(new FileInputStream(file), "UTF-8"); //$NON-NLS-1$
id2cat.putAll(gson.fromJson(reader, Map.class));
} finally {
- if (reader != null) reader.close();
+ if (reader != null) {
+ reader.close();
+ }
}
} catch (IOException e) {
/* ignored on purpose */
@@ -130,9 +139,11 @@ public class CategoryManager implements ICategoryManager {
* @see org.eclipse.tcf.te.ui.views.categories.ICategoryManager#flush()
*/
@Override
- public void flush() {
+ public void flush() {
IPath root = getRoot();
- if (root == null) return;
+ if (root == null) {
+ return;
+ }
// Create the Gson instance
Gson gson = new GsonBuilder().setPrettyPrinting().create();
@@ -145,7 +156,9 @@ public class CategoryManager implements ICategoryManager {
writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); //$NON-NLS-1$
gson.toJson(cat2id, Map.class, writer);
} finally {
- if (writer != null) writer.close();
+ if (writer != null) {
+ writer.close();
+ }
}
} catch (IOException e) {
/* ignored on purpose */
@@ -159,7 +172,9 @@ public class CategoryManager implements ICategoryManager {
writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); //$NON-NLS-1$
gson.toJson(id2cat, Map.class, writer);
} finally {
- if (writer != null) writer.close();
+ if (writer != null) {
+ writer.close();
+ }
}
} catch (IOException e) {
/* ignored on purpose */
@@ -170,7 +185,7 @@ public class CategoryManager implements ICategoryManager {
* @see org.eclipse.tcf.te.ui.views.categories.ICategoryManager#add(java.lang.String, java.lang.String)
*/
@Override
- public boolean add(String categoryId, String id) {
+ public boolean add(String categoryId, String id) {
Assert.isNotNull(categoryId);
Assert.isNotNull(id);
@@ -181,16 +196,24 @@ public class CategoryManager implements ICategoryManager {
ids = new ArrayList<String>();
cat2id.put(categoryId, ids);
}
- if (!ids.contains(id)) added |= ids.add(id);
+ if (!ids.contains(id)) {
+ added |= ids.add(id);
+ }
List<String> cats = id2cat.get(id);
if (cats == null) {
cats = new ArrayList<String>();
id2cat.put(id, cats);
}
- if (!cats.contains(categoryId)) added |= cats.add(categoryId);
+ if (!cats.contains(categoryId)) {
+ added |= cats.add(categoryId);
+ }
- if (added) flush();
+ if (added) {
+ flush();
+ EventManager.getInstance().fireEvent(
+ new ChangeEvent(CategoriesExtensionPointManager.getInstance().getCategory(categoryId, false), ChangeEvent.ID_ADDED, null, id));
+ }
return added;
}
@@ -210,14 +233,23 @@ public class CategoryManager implements ICategoryManager {
ids = new ArrayList<String>();
_t_cat2id.put(categoryId, ids);
}
- if (!ids.contains(id)) added |= ids.add(id);
+ if (!ids.contains(id)) {
+ added |= ids.add(id);
+ }
List<String> cats = _t_id2cat.get(id);
if (cats == null) {
cats = new ArrayList<String>();
_t_id2cat.put(id, cats);
}
- if (!cats.contains(categoryId)) added |= cats.add(categoryId);
+ if (!cats.contains(categoryId)) {
+ added |= cats.add(categoryId);
+ }
+
+ if (added) {
+ EventManager.getInstance().fireEvent(
+ new ChangeEvent(CategoriesExtensionPointManager.getInstance().getCategory(categoryId, false), ChangeEvent.ID_ADDED, null, id));
+ }
return added;
}
@@ -226,7 +258,7 @@ public class CategoryManager implements ICategoryManager {
* @see org.eclipse.tcf.te.ui.views.categories.ICategoryManager#remove(java.lang.String, java.lang.String)
*/
@Override
- public boolean remove(String categoryId, String id) {
+ public boolean remove(String categoryId, String id) {
Assert.isNotNull(categoryId);
Assert.isNotNull(id);
@@ -235,26 +267,38 @@ public class CategoryManager implements ICategoryManager {
List<String> ids = cat2id.get(categoryId);
if (ids != null) {
removed |= ids.remove(id);
- if (ids.isEmpty()) cat2id.remove(categoryId);
+ if (ids.isEmpty()) {
+ cat2id.remove(categoryId);
+ }
}
ids = _t_cat2id.get(categoryId);
if (ids != null) {
removed |= ids.remove(id);
- if (ids.isEmpty()) _t_cat2id.remove(categoryId);
+ if (ids.isEmpty()) {
+ _t_cat2id.remove(categoryId);
+ }
}
List<String> cats = id2cat.get(id);
if (cats != null) {
removed |= cats.remove(categoryId);
- if (cats.isEmpty()) id2cat.remove(id);
+ if (cats.isEmpty()) {
+ id2cat.remove(id);
+ }
}
cats = _t_id2cat.get(id);
if (cats != null) {
removed |= cats.remove(categoryId);
- if (cats.isEmpty()) _t_id2cat.remove(id);
+ if (cats.isEmpty()) {
+ _t_id2cat.remove(id);
+ }
}
- if (removed) flush();
+ if (removed) {
+ flush();
+ EventManager.getInstance().fireEvent(
+ new ChangeEvent(CategoriesExtensionPointManager.getInstance().getCategory(categoryId, false), ChangeEvent.ID_REMOVED, id, null));
+ }
return removed;
}
@@ -263,7 +307,7 @@ public class CategoryManager implements ICategoryManager {
* @see org.eclipse.tcf.te.ui.views.categories.ICategoryManager#belongsTo(java.lang.String, java.lang.String)
*/
@Override
- public boolean belongsTo(String categoryId, String id) {
+ public boolean belongsTo(String categoryId, String id) {
Assert.isNotNull(categoryId);
Assert.isNotNull(id);
@@ -286,13 +330,15 @@ public class CategoryManager implements ICategoryManager {
* @see org.eclipse.tcf.te.ui.views.categories.ICategoryManager#getCategoryIds(java.lang.String)
*/
@Override
- public String[] getCategoryIds(String id) {
+ public String[] getCategoryIds(String id) {
Assert.isNotNull(id);
List<String> allCategories = new ArrayList<String>();
List<String> cats = id2cat.get(id);
- if (cats != null) allCategories.addAll(cats);
+ if (cats != null) {
+ allCategories.addAll(cats);
+ }
cats = _t_id2cat.get(id);
if (cats != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryPropertyTester.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryPropertyTester.java
index e5f8244..d8f2bd5 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryPropertyTester.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/internal/categories/CategoryPropertyTester.java
@@ -1,135 +1,136 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.views.internal.categories;
-
-import org.eclipse.core.expressions.EvaluationContext;
-import org.eclipse.core.expressions.EvaluationResult;
-import org.eclipse.core.expressions.ICountable;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.internal.expressions.CountExpression;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.tcf.te.ui.views.Managers;
-import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
-import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
-
-/**
- * Category property tester.
- */
-@SuppressWarnings("restriction")
-public class CategoryPropertyTester extends PropertyTester {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- @Override
- public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
- if (receiver instanceof IStructuredSelection) {
- // Analyze the selection
- return testSelection((IStructuredSelection)receiver, property, args, expectedValue);
- }
-
- return internalTest(receiver, property, args, expectedValue);
- }
-
- /**
- * Test the specific selection properties.
- *
- * @param selection The selection. Must not be <code>null</code>.
- * @param property The property to test.
- * @param args The property arguments.
- * @param expectedValue The expected value.
- *
- * @return <code>True</code> if the property to test has the expected value, <code>false</code>
- * otherwise.
- */
- protected boolean testSelection(IStructuredSelection selection, String property, Object[] args, Object expectedValue) {
- Assert.isNotNull(selection);
-
- if ("parentCategoryId".equals(property) && !selection.isEmpty()) { //$NON-NLS-1$
- // Only single element selection is supported
- Object element = selection.getFirstElement();
-
- TreePath[] pathes = selection instanceof ITreeSelection ? ((ITreeSelection)selection).getPathsFor(element) : null;
- if (pathes != null) {
- for (TreePath path : pathes) {
- // Find the category within the tree path
- TreePath parentPath = path.getParentPath();
- while (parentPath != null) {
- Object lastSegment = parentPath.getLastSegment();
- if (lastSegment instanceof ICategory
- && ((ICategory)lastSegment).getId().equals(expectedValue)) {
- return true;
- }
- parentPath = parentPath.getParentPath();
- }
- }
- }
- }
-
- if ("validAddToCategoriesCount".equals(property)) { //$NON-NLS-1$
- // Determine the number of valid "Add To" Categories
- AbstractCategoryContributionItem item = new CategoryAddToContributionItem();
- ICategory[] categories = item.getCategories(selection, true);
- final int count = categories.length;
-
- // Re-use the count expression to allow the same value syntax
- String value = expectedValue instanceof String ? (String)expectedValue : expectedValue != null ? expectedValue.toString() : null;
- if (value != null) {
- CountExpression expression = new CountExpression(value);
- IEvaluationContext context = new EvaluationContext(null, new ICountable() {
- @Override
- public int count() {
- return count;
- }
- });
-
- EvaluationResult result = EvaluationResult.FALSE;
- try {
- result = expression.evaluate(context);
- } catch (CoreException e) {
- if (Platform.inDebugMode()) e.printStackTrace();
- }
-
- return result.equals(EvaluationResult.TRUE);
- }
- }
-
- return false;
- }
-
- /**
- * Internal helper to {@link #test(Object, String, Object[], Object)}.
- */
- protected boolean internalTest(Object receiver, String property, Object[] args, Object expectedValue) {
- ICategorizable categorizable = receiver instanceof IAdaptable ? (ICategorizable)((IAdaptable)receiver).getAdapter(ICategorizable.class) : null;
- if (categorizable == null) categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(receiver, ICategorizable.class);
-
- if ("belongsTo".equals(property) && categorizable != null) { //$NON-NLS-1$
- String id = categorizable.getId();
- if (id != null && expectedValue instanceof String) {
- return Managers.getCategoryManager().belongsTo((String)expectedValue, id);
- }
- }
-
- if ("isCategoryID".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$
- String id = ((ICategory)receiver).getId();
- return id.equals(expectedValue);
- }
-
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.internal.categories;
+
+import org.eclipse.core.expressions.EvaluationContext;
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.ICountable;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.internal.expressions.CountExpression;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.tcf.te.ui.views.Managers;
+import org.eclipse.tcf.te.ui.views.handler.CategoryAddToContributionItem;
+import org.eclipse.tcf.te.ui.views.interfaces.ICategory;
+import org.eclipse.tcf.te.ui.views.interfaces.categories.ICategorizable;
+
+/**
+ * Category property tester.
+ */
+@SuppressWarnings("restriction")
+public class CategoryPropertyTester extends PropertyTester {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ */
+ @Override
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ if (receiver instanceof IStructuredSelection) {
+ // Analyze the selection
+ return testSelection((IStructuredSelection)receiver, property, args, expectedValue);
+ }
+
+ return internalTest(receiver, property, args, expectedValue);
+ }
+
+ /**
+ * Test the specific selection properties.
+ *
+ * @param selection The selection. Must not be <code>null</code>.
+ * @param property The property to test.
+ * @param args The property arguments.
+ * @param expectedValue The expected value.
+ *
+ * @return <code>True</code> if the property to test has the expected value, <code>false</code>
+ * otherwise.
+ */
+ protected boolean testSelection(IStructuredSelection selection, String property, Object[] args, Object expectedValue) {
+ Assert.isNotNull(selection);
+
+ if ("parentCategoryId".equals(property) && !selection.isEmpty()) { //$NON-NLS-1$
+ // Only single element selection is supported
+ Object element = selection.getFirstElement();
+
+ TreePath[] pathes = selection instanceof ITreeSelection ? ((ITreeSelection)selection).getPathsFor(element) : null;
+ if (pathes != null) {
+ for (TreePath path : pathes) {
+ // Find the category within the tree path
+ TreePath parentPath = path.getParentPath();
+ while (parentPath != null) {
+ Object lastSegment = parentPath.getLastSegment();
+ if (lastSegment instanceof ICategory
+ && ((ICategory)lastSegment).getId().equals(expectedValue)) {
+ return true;
+ }
+ parentPath = parentPath.getParentPath();
+ }
+ }
+ }
+ }
+
+ if ("validAddToCategoriesCount".equals(property)) { //$NON-NLS-1$
+ // Determine the number of valid "Add To" Categories
+ AbstractCategoryContributionItem item = new CategoryAddToContributionItem();
+ ICategory[] categories = item.getCategories(selection, true);
+ final int count = categories.length;
+
+ // Re-use the count expression to allow the same value syntax
+ String value = expectedValue instanceof String ? (String)expectedValue : expectedValue != null ? expectedValue.toString() : null;
+ if (value != null) {
+ CountExpression expression = new CountExpression(value);
+ IEvaluationContext context = new EvaluationContext(null, new ICountable() {
+ @Override
+ public int count() {
+ return count;
+ }
+ });
+
+ EvaluationResult result = EvaluationResult.FALSE;
+ try {
+ result = expression.evaluate(context);
+ } catch (CoreException e) {
+ if (Platform.inDebugMode()) e.printStackTrace();
+ }
+
+ return result.equals(EvaluationResult.TRUE);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Internal helper to {@link #test(Object, String, Object[], Object)}.
+ */
+ protected boolean internalTest(Object receiver, String property, Object[] args, Object expectedValue) {
+ ICategorizable categorizable = receiver instanceof IAdaptable ? (ICategorizable)((IAdaptable)receiver).getAdapter(ICategorizable.class) : null;
+ if (categorizable == null) categorizable = (ICategorizable)Platform.getAdapterManager().getAdapter(receiver, ICategorizable.class);
+
+ if ("belongsTo".equals(property) && categorizable != null) { //$NON-NLS-1$
+ String id = categorizable.getId();
+ if (id != null && expectedValue instanceof String) {
+ return Managers.getCategoryManager().belongsTo((String)expectedValue, id);
+ }
+ }
+
+ if ("isCategoryID".equals(property) && receiver instanceof ICategory) { //$NON-NLS-1$
+ String id = ((ICategory)receiver).getId();
+ return id.equals(expectedValue);
+ }
+
+ return false;
+ }
+}