1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

[222263] fix: Need to provide a PropertySet Adapter for System Team View

This commit is contained in:
Xuan Chen 2008-03-28 19:44:14 +00:00
parent 145f846449
commit eda29e5918
17 changed files with 523 additions and 53 deletions

View file

@ -18,6 +18,7 @@
* David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
* Rupen Mardirossian (IBM) - [210682] Added BUTTON_OVERWRITE_ALL & and tooltip, also added some verbiage for new SystemCopyDialog.
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
*******************************************************************************/
package org.eclipse.rse.internal.ui;
@ -389,12 +390,16 @@ public class SystemResources extends NLS
// TEAM VIEW
public static String RESID_TEAMVIEW_SUBSYSFACTORY_VALUE;
public static String RESID_TEAMVIEW_CATEGORY_VALUE;
public static String RESID_TEAMVIEW_PROPERTYSET_VALUE;
public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL;
public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP;
public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL;
public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP;
public static String RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL;
public static String RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP;
// ------------------------------
// REUSABLE WIDGET STRINGS...

View file

@ -19,6 +19,7 @@
# David Dykstal (IBM) - [142452] copy operations for connections, filterpools, and filters should be named "Copy..."
# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
# Rupen Mardirossian (IBM) - [210692] Define strings for SystemCopyDialog
# Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
################################################################################
# NLS_MESSAGEFORMAT_VAR
@ -572,6 +573,7 @@ RESID_WORKWITHHISTORY_BUTTON_TIP=Bring up the Work With History dialog
#=============================================================
RESID_TEAMVIEW_SUBSYSFACTORY_VALUE=SubSystem factory
RESID_TEAMVIEW_CATEGORY_VALUE=Category
RESID_TEAMVIEW_PROPERTYSET_VALUE=Property set
RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL=Connections
@ -580,6 +582,9 @@ RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP=Lists all connections in this profil
RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL=Filter pools
RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP=Lists all filter pools and filters in this profile, per subsystem type that contains them.
RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL=Property sets
RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP=Lists all property sets in this profile
#=============================================================
# Specific actions. All actions support:
# .label for button/menu-item text

View file

@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -33,6 +34,8 @@ import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryAdapter;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryNode;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewProfileAdapter;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetAdapter;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetNode;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationAdapter;
import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
import org.eclipse.rse.ui.SystemBasePlugin;
@ -63,6 +66,7 @@ public class SystemViewAdapterFactory implements IAdapterFactory {
private SystemTeamViewProfileAdapter profileAdapter = new SystemTeamViewProfileAdapter();
private SystemTeamViewCategoryAdapter categoryAdapter = new SystemTeamViewCategoryAdapter();
private SystemTeamViewSubSystemConfigurationAdapter subsysFactoryAdapter = new SystemTeamViewSubSystemConfigurationAdapter();
private SystemTeamViewPropertySetAdapter propertySetAdapter = new SystemTeamViewPropertySetAdapter();
private SystemViewFilterStringAdapter filterStringAdapter = new SystemViewFilterStringAdapter();
@ -94,6 +98,7 @@ public class SystemViewAdapterFactory implements IAdapterFactory {
manager.registerAdapters(this, ISystemPromptableObject.class);
manager.registerAdapters(this, SystemTeamViewCategoryNode.class);
manager.registerAdapters(this, SystemTeamViewSubSystemConfigurationNode.class);
manager.registerAdapters(this, SystemTeamViewPropertySetNode.class);
// FIXME - UDAs no longer in core
//manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class);
@ -140,6 +145,7 @@ public class SystemViewAdapterFactory implements IAdapterFactory {
} else if (adaptableObject instanceof SystemTeamViewCategoryNode)
adapter = categoryAdapter;
else if (adaptableObject instanceof SystemTeamViewSubSystemConfigurationNode) adapter = subsysFactoryAdapter;
else if (adaptableObject instanceof SystemTeamViewPropertySetNode) adapter = propertySetAdapter;
/** FIXME - UDAs no longer in core
else if (adaptableObject instanceof SystemTeamViewCompileTypeNode)

View file

@ -15,6 +15,7 @@
* David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
* David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
*******************************************************************************/
package org.eclipse.rse.internal.ui.view;
@ -127,6 +128,7 @@ public class SystemViewResources extends NLS {
// Property sheet values: Categories in Team view
public static String RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE;
public static String RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE;
public static String RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE;
// Miscellaneous / common
public static String RESID_SCRATCHPAD;

View file

@ -15,6 +15,7 @@
# David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
# David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
# Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
###############################################################################
# NLS_MESSAGEFORMAT_VAR
@ -107,6 +108,7 @@ RESID_PROPERTY_MESSAGE_TYPE_VALUE=Message
#TEAM VIEW PROPERTIES
RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE=Category
RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE=SubSystem factory
RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE=Property set
RESID_SCRATCHPAD=Scratchpad

View file

@ -19,6 +19,7 @@
* David Dykstal (IBM) - [197036] rewrote getSubSystemConfigurationNodes to get filter pools
* in a way that delays the loading of subsystem configurations
* Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
*******************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
@ -35,6 +36,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertySetContainer;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
@ -162,6 +165,10 @@ public class SystemTeamViewCategoryAdapter
{
return profile.getHosts();
}
else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_PROPERTYSETS))
{
return createSystemTeamViewPropertySetNodes(profile, category);
}
else
return createSubSystemConfigurationNodes(profile, category);
}
@ -214,6 +221,27 @@ public class SystemTeamViewCategoryAdapter
nodes.toArray(result);
return result;
}
/**
* Create subsystem configuration child nodes for expanded category node.
*/
private SystemTeamViewPropertySetNode[] createSystemTeamViewPropertySetNodes(IPropertySetContainer profile, SystemTeamViewCategoryNode category) {
IPropertySet[] propertySets = profile.getPropertySets();
if (null == propertySets || propertySets.length == 0)
{
return new SystemTeamViewPropertySetNode[0];
}
// construct the nodes for the view based on these configurations
List nodes = new ArrayList();
//String categoryType = category.getMementoHandle();
for (int i = 0; i < propertySets.length; i++) {
nodes.add(new SystemTeamViewPropertySetNode(profile, propertySets[i]));
}
SystemTeamViewPropertySetNode[] result = new SystemTeamViewPropertySetNode[nodes.size()];
nodes.toArray(result);
return result;
}
/**
* Return true if this profile has children. We return true.

View file

@ -13,6 +13,7 @@
*
* Contributors:
* {Name} (company) - description of contribution.
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
*******************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
@ -37,6 +38,7 @@ public class SystemTeamViewCategoryNode implements IAdaptable
public static final String MEMENTO_FILTERPOOLS = "pools"; //$NON-NLS-1$
public static final String MEMENTO_USERACTIONS = "actions"; //$NON-NLS-1$
public static final String MEMENTO_COMPILECMDS = "cmds"; //$NON-NLS-1$
public static final String MEMENTO_PROPERTYSETS = "propertysets"; //$NON-NLS-1$
public static final String MEMENTO_TARGETS = "targets"; //$NON-NLS-1$
/**

View file

@ -16,14 +16,19 @@
* David Dykstal (IBM) - [189858] Removed the remote systems project in the team view
* Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
* Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
*******************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemViewInputProvider;
import org.eclipse.rse.internal.core.model.SystemProfileManager;
@ -98,8 +103,18 @@ public class SystemTeamViewInputProvider implements IAdaptable, ISystemViewInput
*/
public Object[] getConnectionChildren(IHost selectedConnection)
{
// TODO Auto-generated method stub
return null;
IPropertySet[] propertySets = selectedConnection.getPropertySets();
if (null == propertySets || propertySets.length == 0)
{
return new SystemTeamViewPropertySetNode[0];
}
List nodes = new ArrayList();
for (int i = 0; i < propertySets.length; i++) {
nodes.add(new SystemTeamViewPropertySetNode(selectedConnection, propertySets[i]));
}
SystemTeamViewPropertySetNode[] result = new SystemTeamViewPropertySetNode[nodes.size()];
nodes.toArray(result);
return result;
}
/* (non-Javadoc)
@ -107,8 +122,13 @@ public class SystemTeamViewInputProvider implements IAdaptable, ISystemViewInput
*/
public boolean hasConnectionChildren(IHost selectedConnection)
{
// TODO Auto-generated method stub
return false;
IPropertySet[] sets = selectedConnection.getPropertySets();
if (sets == null || sets.length == 0){
return false;
}
else {
return true;
}
}
/* (non-Javadoc)

View file

@ -22,6 +22,7 @@
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
* David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
* David Dykstal (IBM) - [cleanup] formatted
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
@ -201,7 +202,7 @@ public class SystemTeamViewProfileAdapter extends AbstractSystemViewAdapter {
public SystemTeamViewCategoryNode[] getCategoryChildren(ISystemProfile profile) {
SystemTeamViewCategoryNode[] children = (SystemTeamViewCategoryNode[]) categoriesByProfile.get(profile);
if (children == null) {
children = new SystemTeamViewCategoryNode[2]; //5];
children = new SystemTeamViewCategoryNode[3]; //5];
for (int idx = 0; idx < children.length; idx++)
children[idx] = new SystemTeamViewCategoryNode(profile);
children[0].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL);
@ -213,6 +214,11 @@ public class SystemTeamViewProfileAdapter extends AbstractSystemViewAdapter {
children[1].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP);
children[1].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID));
children[1].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS);
children[2].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL);
children[2].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP);
children[2].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID));
children[2].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_PROPERTYSETS);
/*
children[2].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_USERACTIONS_LABEL);
children[2].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP);

View file

@ -0,0 +1,257 @@
/*********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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:
* Xuan Chen (IBM) - [222263] initial contribution.
*********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.model.IProperty;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.internal.ui.SystemResources;
import org.eclipse.rse.internal.ui.view.SystemViewResources;
import org.eclipse.rse.ui.SystemMenuManager;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.PropertyDescriptor;
/**
* Adapter for displaying and processing SystemTeamViewSubSystemConfigurationNode objects in tree views, such as
* the Team view.
*/
public class SystemTeamViewPropertySetAdapter
extends AbstractSystemViewAdapter
{
private boolean actionsCreated = false;
// -------------------
// property descriptors
// -------------------
private static PropertyDescriptor[] propertyDescriptorArray = null;
/**
* Returns any actions that should be contributed to the popup menu
* for the given element.
* @param menu The menu to contribute actions to
* @param selection The window's current selection.
* @param shell Shell of viewer
* @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
*/
public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
{
if (!actionsCreated)
createActions();
}
private void createActions()
{
actionsCreated = true;
}
/**
* Returns an image descriptor for the image. More efficient than getting the image.
* @param element The element for which an image is desired
*/
public ImageDescriptor getImageDescriptor(Object element)
{
return ((SystemTeamViewPropertySetNode)element).getImageDescriptor();
}
/**
* Return the label for this object
*/
public String getText(Object element)
{
return ((SystemTeamViewPropertySetNode)element).getLabel();
}
/**
* Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
* <p>
* Called by common rename and delete actions.
*/
public String getName(Object element)
{
return ((SystemTeamViewPropertySetNode)element).getLabel();
}
/*
* (non-Javadoc)
* @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
*/
public String getAbsoluteName(Object element)
{
SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
return factory.getLabel();
}
/**
* Return the type label for this object
*/
public String getType(Object element)
{
return SystemViewResources.RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE;
}
/**
* Return the string to display in the status line when the given object is selected.
*/
public String getStatusLineText(Object element)
{
SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
return SystemResources.RESID_TEAMVIEW_PROPERTYSET_VALUE + ": " + factory.getLabel(); //$NON-NLS-1$
}
/**
* Return the parent of this object. We return the RemoteSystemsConnections project
*/
public Object getParent(Object element)
{
SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
return factory.getParent();
}
/**
* Return the children of this profile.
*/
public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
{
SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)element;
IPropertySet propertySet = propertySetNode.getPropertySet();
IPropertySet[] children = propertySet.getPropertySets();
if (null == children || children.length == 0)
{
return new Object[0];
}
// construct the nodes for the view based on these configurations
SystemTeamViewPropertySetNode[] nodes = new SystemTeamViewPropertySetNode[children.length];
//String categoryType = category.getMementoHandle();
for (int i = 0; i < children.length; i++)
{
nodes[i] = new SystemTeamViewPropertySetNode(propertySet, children[i]);
}
return nodes;
}
/**
* Return true if this profile has children. We return true.
*/
public boolean hasChildren(IAdaptable element)
{
SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)element;
IPropertySet propertySet = propertySetNode.getPropertySet();
IPropertySet[] children = propertySet.getPropertySets();
if (null == children || children.length == 0)
{
return false;
}
return true;
}
/**
* For PropertySet Node Adapter, we need to override this method since we don't want to display "name" and "type" twice.
*
* @return an array containing all descriptors.
*
* @see #internalGetPropertyDescriptors()
*/
public IPropertyDescriptor[] getPropertyDescriptors()
{
return internalGetPropertyDescriptors();
}
protected IPropertyDescriptor[] internalGetPropertyDescriptors()
{
SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)propertySourceInput;
IPropertySet propertySet = propertySetNode.getPropertySet();
String[] propertyKeys = propertySet.getPropertyKeys();
int size = propertyKeys.length;
IProperty nameProperty = propertySet.getProperty(SystemTeamViewPropertySetNode.NAME_PROPERTY);
if (null == nameProperty)
{
nameProperty = propertySet.getProperty(SystemTeamViewPropertySetNode.NAME_PROPERTY1);
}
int startingIndex = 0;
if (nameProperty == null)
{
size++;
}
propertyDescriptorArray = new PropertyDescriptor[size];
if (nameProperty == null)
{
propertyDescriptorArray[startingIndex++] = createSimplePropertyDescriptor(SystemTeamViewPropertySetNode.NAME_PROPERTY, SystemTeamViewPropertySetNode.NAME_PROPERTY, propertySet.getName());
}
for (int i = startingIndex, j = 0; i < size; i++, j++)
{
propertyDescriptorArray[i] = createSimplePropertyDescriptor(propertyKeys[j], propertyKeys[j], propertySet.getPropertyValue(propertyKeys[j]));
}
return propertyDescriptorArray;
}
/**
* Returns the current value for the named property.
* The parent handles P_TEXT and P_TYPE only, and we augment that here.
* @param key - the name of the property as named by its property descriptor
* @return the current value of the property
*/
public Object internalGetPropertyValue(Object key)
{
SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)propertySourceInput;
IPropertySet propertySet = propertySetNode.getPropertySet();
return propertySet.getPropertyValue((String)key);
}
// ------------------------------------------------------------
// METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
// ------------------------------------------------------------
/**
* Return what to save to disk to identify this element in the persisted list of expanded elements.
*/
public String getMementoHandle(Object element)
{
SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
return factory.getMementoHandle();
}
/**
* Return a short string to uniquely identify the type of resource.
*/
public String getMementoHandleKey(Object element)
{
SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
return factory.getLabel(); //$NON-NLS-1$
}
/**
* This is a local RSE artifact so returning false
*
* @param element the object to check
* @return false since this is not remote
*/
public boolean isRemote(Object element) {
return false;
}
}

View file

@ -0,0 +1,146 @@
/*********************************************************************************
* Copyright (c) 2008 IBM Corporation. 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:
* Xuan Chen (IBM) - [222263] initial contribution.
*********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.model.IProperty;
import org.eclipse.rse.core.model.IPropertySet;
import org.eclipse.rse.core.model.IPropertySetContainer;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* This class represents a child node under category nodes, in the Team view.
* It represents expandable subsystem factories such as "Files" or "iSeries Objects".
*/
public class SystemTeamViewPropertySetNode implements IAdaptable
{
private String mementoHandle;
private IPropertySetContainer parent;
private IPropertySet propertySet;
static public final String NAME_PROPERTY = "name"; //$NON-NLS-1$
static public final String NAME_PROPERTY1 = "Name"; //$NON-NLS-1$
/**
* Constructor
*/
public SystemTeamViewPropertySetNode(IPropertySetContainer parent, IPropertySet propertySet)
{
super();
this.parent = parent;
this.propertySet = propertySet;
}
/**
* This is the method required by the IAdaptable interface.
* Given an adapter class type, return an object castable to the type, or
* null if this is not possible.
*/
public Object getAdapter(Class adapterType)
{
return Platform.getAdapterManager().getAdapter(this, adapterType);
}
/**
* Compare this node to another.
*/
public boolean equals(Object o)
{
if (o instanceof SystemTeamViewPropertySetNode)
{
/*
SystemTeamViewPropertySetNode other = (SystemTeamViewPropertySetNode)o;
if ((ssf == other.getSubSystemConfiguration()) &&
(parentCategory == other.getParentCategory()) &&
(profile == other.getProfile()))
return true;
else
return false;
*/
return super.equals(o);
}
else
return super.equals(o);
}
/**
* Return this node's image
* @return the image to show in the tree, for this node
*/
public ImageDescriptor getImageDescriptor()
{
return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID);
}
public Object getParent()
{
return parent;
}
/**
* Return this node's label
* @return the translated label to show in the tree, for this node
*/
public String getLabel()
{
String label = null;
//First, check if this PropertySet has a property called "name"
IProperty nameProperty = propertySet.getProperty(NAME_PROPERTY);
if (null != nameProperty)
{
label = nameProperty.getValue();
}
else
{
label = propertySet.getName();
}
return label;
}
/**
* Convert to string. We call getLabel()
*/
public String toString()
{
return getLabel();
}
/**
* @return PropertySet this node is associated with
*/
public IPropertySet getPropertySet()
{
return propertySet;
}
/**
* @return the untranslated value to store in the memento, to uniquely identify this node
*/
public String getMementoHandle()
{
return mementoHandle;
}
/**
* Set the untranslated value to store in the memento, to uniquely identify this node
* @param string - untranslated value
*/
public void setMementoHandle(String string)
{
mementoHandle = string;
}
}

View file

@ -9,6 +9,7 @@ package org.eclipse.rse.internal.useractions.files.uda;
*
* Contributors:
* IBM Corporation - initial API and implementation
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@ -451,6 +452,7 @@ public class UDActionSubsystemFiles extends SystemUDActionSubsystem {
if (null == userDefinedActionPropertySet)
{
userDefinedActionPropertySet = profile.createPropertySet(userDefinedActionPropertySetName);
userDefinedActionPropertySet.addProperty(ISystemUDAConstants.NAME_ATTR, ISystemUDAConstants.USER_DEFINED_ACTION_PROPRERTY_SET_Name);
userDefinedActionPropertySet.addProperty(ISystemUDAConstants.RELEASE_ATTR, ISystemUDAConstants.RELEASE_VALUE);
userDefinedActionPropertySet.addProperty(ISystemUDAConstants.UDA_ROOT_ATTR, actionMgr.getDocumentRootTagName());
}

View file

@ -1,3 +1,15 @@
/*******************************************************************************
* Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
import org.eclipse.rse.core.RSECorePlugin;
@ -6,11 +18,10 @@ import org.eclipse.rse.core.RSECorePlugin;
* Constants used in the persistence of the compile commands, into an xml file
*/
public interface ISystemCompileXMLConstants {
// The file name to use to store the xml file that
// holds info on compile name associations for a
// profile
public static final String COMPILE_COMMAND_PROPRERTY_SET_PREFIX = "CC."; //$NON-NLS-1$
public static final String FILE_NAME = "compileCommands.xml"; //$NON-NLS-1$
public static final String COMPILE_COMMAND_PROPRERTY_SET_PREFIX = "CompileCommand."; //$NON-NLS-1$
public static final String COMPILE_COMMAND_NAME = "Compile Commands"; //$NON-NLS-1$
// root tag
/**
* The name of the root element (tag) for the compile types xml file. That element is named "types".
@ -41,7 +52,7 @@ public interface ISystemCompileXMLConstants {
* The xml element is named "compiletype".
*/
public static final String TYPE_ELEMENT = "compiletype"; //$NON-NLS-1$
public static final String TYPE_ATTRIBUTE = "sourcetype"; //$NON-NLS-1$
public static final String SOURCETYPE_ATTRIBUTE = "sourcetype"; //$NON-NLS-1$
/**
* The name of the attribute holding the last-used compile command. This value identifies that
* command via its label value.
@ -63,6 +74,7 @@ public interface ISystemCompileXMLConstants {
* were called compile names).
*/
public static final String LABEL_ATTRIBUTE = "name"; //$NON-NLS-1$
public static final String TYPE_ATTRIBUTE = "type"; //$NON-NLS-1$
/**
* The name of the attribute holding the nature value. This tells the framework if this is
* an IBM-supplied or user-supplied compile command. The xml attribute is named "nature".

View file

@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [180562][api] dont implement ISystemCompileXMLConstants
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.compile;
@ -183,30 +184,6 @@ public abstract class SystemCompileProfile {
return parentManager.getCompileProfileFolder(this);
}
/**
* Should you require access to the IFile handle to the persisted xml file,
* call this method. Note, this file is only created on first touch,
* so file may be a handle to something that doesn't exist yet.
*/
public IFile getCompileProfileFile() {
IFolder folder = getCompileFolder();
IFile file = folder.getFile(getSaveFileName());
return file;
}
/**
* Should you require access to the java.io.File handle to the persisted xml file,
* call this method. Note, this file is only created on first touch,
* so file may be a handle to something that doesn't exist yet.
*/
public File getCompileProfileJavaFile() {
IFolder folder = getCompileFolder();
IPath path = folder.getLocation().makeAbsolute();
path = path.append(IPath.SEPARATOR + getSaveFileName());
File file = new File(path.makeAbsolute().toOSString());
return file;
}
// -------------------
// ABSTRACT METHODS...
// -------------------
@ -218,18 +195,6 @@ public abstract class SystemCompileProfile {
*/
public abstract SystemCompilableSource getCompilableSourceObject(Shell shell, Object selectedObject, SystemCompileCommand compileCmd, boolean isPrompt, Viewer viewer);
// -----------------------------------
// POTENTIALLY OVERRIDABLE METHODS...
// -----------------------------------
/**
* Return the name of the xml file we will persist this profile's compile command
* information to.
* The default is "compile.xml" and need not be overridden unless you don't like that name :-).
*/
protected String getSaveFileName() {
return ISystemCompileXMLConstants.FILE_NAME;
}
/**
* This method is called by the constructor, prior to reading the xml contents from disk.
* It is an exit point in case subclasses need to do anything before the read, such as rename
@ -531,6 +496,8 @@ public abstract class SystemCompileProfile {
if (null == compileCommandPropertySet)
{
compileCommandPropertySet = systemProfile.createPropertySet(compileCommandPropertySetName);
//Set its name and type attributes
compileCommandPropertySet.addProperty(ISystemCompileXMLConstants.LABEL_ATTRIBUTE, ISystemCompileXMLConstants.COMPILE_COMMAND_NAME);
}
// write type and compile commands for each
for (int i = 0; i < types.size(); i++) {
@ -548,8 +515,10 @@ public abstract class SystemCompileProfile {
IPropertySet thisCompileTypePropertySet = compileCommandPropertySet.createPropertySet(compileType.getType() + i);
//Set its properties.
thisCompileTypePropertySet.addProperty(ISystemCompileXMLConstants.TYPE_ATTRIBUTE, ISystemCompileXMLConstants.TYPE_ELEMENT);
thisCompileTypePropertySet.addProperty(ISystemCompileXMLConstants.LABEL_ATTRIBUTE, compileType.getType());
thisCompileTypePropertySet.addProperty(ISystemCompileXMLConstants.LASTUSED_ATTRIBUTE, lastUsedName);
thisCompileTypePropertySet.addProperty(ISystemCompileXMLConstants.TYPE_ATTRIBUTE, compileType.getType());
thisCompileTypePropertySet.addProperty(ISystemCompileXMLConstants.SOURCETYPE_ATTRIBUTE, compileType.getType());
Vector cmds = compileType.getCompileCommands();
for (int j = 0; j < cmds.size(); j++) {
SystemCompileCommand cmd = (SystemCompileCommand) (cmds.get(j));
@ -559,6 +528,7 @@ public abstract class SystemCompileProfile {
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.ID_ATTRIBUTE, cmd.getId());
}
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.LABEL_ATTRIBUTE, cmd.getLabel());
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.TYPE_ATTRIBUTE, ISystemCompileXMLConstants.COMPILECOMMAND_ELEMENT);
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.NATURE_ATTRIBUTE, cmd.getNature());
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.DEFAULT_ATTRIBUTE, cmd.getDefaultString());
thisCompileCommandPropertySet.addProperty(ISystemCompileXMLConstants.CURRENT_ATTRIBUTE, cmd.getCurrentString());

View file

@ -9,6 +9,7 @@ package org.eclipse.rse.internal.useractions.ui.uda;
*
* Contributors:
* IBM Corporation - initial API and implementation
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
/**
* @author coulthar
@ -17,11 +18,14 @@ package org.eclipse.rse.internal.useractions.ui.uda;
*/
public interface ISystemUDAConstants {
public static final String USER_DEFINED_ACTION_PROPRERTY_SET_PREFIX = "UDA."; //$NON-NLS-1$
public static final String USER_DEFINED_ACTION_PROPRERTY_SET_PREFIX = "UserActoins."; //$NON-NLS-1$
public static final String USER_DEFINED_ACTION_PROPRERTY_SET_Name = "User Actions"; //$NON-NLS-1$
static final String UDA_ROOT_ATTR = "uda_root"; //$NON-NLS-1$
static final String FILETYPES_ROOT = "FileTypes"; //$NON-NLS-1$
static final String ACTIONS_ROOT = "Actions"; //$NON-NLS-1$
static final String ACTION_FILETYPES = "User Action File Types"; //$NON-NLS-1$
/**
* The name of the xml tag for domain tags.
@ -41,15 +45,15 @@ public interface ISystemUDAConstants {
* identifies the domain name. Its values will be
* a translated name like "Object" or "Folder".
*/
public static final String XE_DOMNAME = "Name"; //$NON-NLS-1$
public static final String XE_DOMNAME = "name"; //$NON-NLS-1$
/**
* The name of the attribute we consistently use to store an element's name
*/
public static final String NAME_ATTR = "Name"; //$NON-NLS-1$
public static final String NAME_ATTR = "name"; //$NON-NLS-1$
/**
* The type of the attribute we consistently use to store an element's name
*/
public static final String TYPE_ATTR = "Type"; //$NON-NLS-1$
public static final String TYPE_ATTR = "type"; //$NON-NLS-1$
/**
* The name of the attribute we consistently use to store an element's original IBM-supplied name

View file

@ -11,6 +11,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
* API to the user actions plugin
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -990,6 +991,7 @@ public abstract class SystemUDBaseManager implements IResourceChangeListener, IS
if (udaRootPropertySet == null)
{
udaRootPropertySet = profile.createPropertySet(udaRootPropertySetName);
udaRootPropertySet.addProperty(ISystemUDAConstants.NAME_ATTR, ISystemUDAConstants.ACTION_FILETYPES);
udaRootPropertySet.addProperty(ISystemUDAConstants.RELEASE_ATTR, CURRENT_RELEASE_NAME);
udaRootPropertySet.addProperty(ISystemUDAConstants.UDA_ROOT_ATTR, getDocumentRootTagName());
}

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [180562][api] dont implement ISystemUDAConstants
* Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View (cleanup some use action stuff)
*******************************************************************************/
package org.eclipse.rse.internal.useractions.ui.uda;
@ -169,7 +170,7 @@ public abstract class SystemXMLElementWrapper implements IAdaptable {
}
/**
* Return the value of this node's "Name" attribute
* Return the value of this node's "name" attribute
*/
public String getName() {
return elm.getPropertyValue(ISystemUDAConstants.NAME_ATTR);