Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.perspective.model.util
Class ISeriesModelUtil

java.lang.Object
  extended by com.ibm.etools.iseries.perspective.model.util.ISeriesModelUtil

public class ISeriesModelUtil
extends Object

This is a general utility class for dealing with the iSeries projects object model.


Field Summary
static String COPYRIGHT
           
 
Constructor Summary
ISeriesModelUtil()
           
 
Method Summary
static boolean allISeriesResourcesAreOfType(IStructuredSelection selection, int resourceMask)
          Returns whether the types of the resources in the given selection are among the specified iseries resource types.
An example of a resource mask is as follows:
static AbstractISeriesResource castToISeriesResource(Object object)
          Tests wether the passed object is an iSeries Projects model object.
static String findFirstDifferentProperty(IISeriesPropertiesModel propertiesModel, Properties properties)
          Returns the key to the first property in the properties parameter that is different than its equivalent in the passed properties model.
static AbstractISeriesResource findISeriesResource(IResource resource)
          Finds an iSeries resource that represents the given IResource.
returns null if no iSeries Resource is found.
static com.ibm.etools.iseries.perspective.internal.model.impl.ISeriesProjectRoot getISeriesProjectRoot()
          Synchronizes and returns iSeries Project Root for the iSeries projects model.
This root holds all iSeries Projects.
static boolean iSeriesResourceIsType(AbstractISeriesResource resource, int resourceMask)
          Returns whether the type of the given resource is among the specified resource types.
static void selectRevealInISeriesProjectView(AbstractISeriesResource resource, IWorkbenchWindow window, boolean expandSelection)
          Attempts to select and reveal the specified AbstractISeriesResource in all parts within the supplied workbench window's active page.
static void selectRevealInISeriesProjectView(IResource resource, boolean expandSelection)
          Convenience method for calling selectRevealInISeriesProjectView against the current active workbench window.
static void selectRevealInISeriesProjectView(IResource resource, IWorkbenchWindow window, boolean expandSelection)
          Attempts to select and reveal the specified IResource in all parts within the supplied workbench window's active page.
static void showISeriesProjectPerspective()
          Opens up the iSeries Project Perspective according to the user's Preference settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final String COPYRIGHT
See Also:
Constant Field Values
Constructor Detail

ISeriesModelUtil

public ISeriesModelUtil()
Method Detail

getISeriesProjectRoot

public static final com.ibm.etools.iseries.perspective.internal.model.impl.ISeriesProjectRoot getISeriesProjectRoot()
Synchronizes and returns iSeries Project Root for the iSeries projects model.
This root holds all iSeries Projects.

Returns:
ISeriesProjectRoot The iSeries project root.

castToISeriesResource

public static final AbstractISeriesResource castToISeriesResource(Object object)
Tests wether the passed object is an iSeries Projects model object. If it is returns the object cast to an AbstractISeriesResource. Otherwise returns null.

Returns:
AbstractISeriesResource Returns the passed object as an instance of AbstractISeriesResource, or null if it is not.

showISeriesProjectPerspective

public static void showISeriesProjectPerspective()
Opens up the iSeries Project Perspective according to the user's Preference settings. These settings are in the Workbench -> Perspectives preference page.


findISeriesResource

public static final AbstractISeriesResource findISeriesResource(IResource resource)
Finds an iSeries resource that represents the given IResource.
returns null if no iSeries Resource is found. This method will force a synchnorize on resource objects in the model.


iSeriesResourceIsType

public static final boolean iSeriesResourceIsType(AbstractISeriesResource resource,
                                                  int resourceMask)
Returns whether the type of the given resource is among the specified resource types.

Parameters:
resource - the resource
resourceMask - resource mask formed by bitwise OR of resource type constants (defined on AbstractISeriesResource)
Returns:
true if the resources has a matching type, and false otherwise.
See Also:
AbstractISeriesResource.getType()

allISeriesResourcesAreOfType

public static final boolean allISeriesResourcesAreOfType(IStructuredSelection selection,
                                                         int resourceMask)
Returns whether the types of the resources in the given selection are among the specified iseries resource types.
An example of a resource mask is as follows:

int resourceMask = AbstractISeriesResource.NATIVE_OBJECT | AbstractISeriesResource.NATIVE_MEMBER;

Returns:
true if all selected elements are resources of the right type, and false if the selection is empty, or at least one element is either a resource of some other type or not an AbstractISeriesResource resource.

findFirstDifferentProperty

public static final String findFirstDifferentProperty(IISeriesPropertiesModel propertiesModel,
                                                      Properties properties)
Returns the key to the first property in the properties parameter that is different than its equivalent in the passed properties model.

Parameters:
propertiesModel - the model to compare against
properties - the properties to compare.
Returns:
String the first different property key.

selectRevealInISeriesProjectView

public static final void selectRevealInISeriesProjectView(AbstractISeriesResource resource,
                                                          IWorkbenchWindow window,
                                                          boolean expandSelection)
Attempts to select and reveal the specified AbstractISeriesResource in all parts within the supplied workbench window's active page.

Checks all parts in the active page to see if they implement ISetSelectionTarget, either directly or as an adapter. If so, tells the part to select and reveal the specified resource. If the iSeries Project View is open in the current active page, it is given focus.

Parameters:
resource - the resource to be selected and revealed
window - the workbench window to select and reveal the resource
expandSelection - flag indicating whether the resource should be expanded once it is seleceted and revealed.
See Also:
ISetSelectionTarget

selectRevealInISeriesProjectView

public static final void selectRevealInISeriesProjectView(IResource resource,
                                                          IWorkbenchWindow window,
                                                          boolean expandSelection)
Attempts to select and reveal the specified IResource in all parts within the supplied workbench window's active page.

Checks all parts in the active page to see if they implement ISetSelectionTarget, either directly or as an adapter. If so, tells the part to select and reveal the specified resource. If the iSeries Project View is open in the current active page, it is given focus. Note that since the object to select is an IResource, the method actually selects it AbstractISeriesResource equivalent in the iSeries Project Viewer.

Parameters:
resource - the resource to be selected and revealed
window - the workbench window to select and reveal the resource
expandSelection - flag indicating whether the resource should be expanded once it is seleceted and revealed.
See Also:
ISetSelectionTarget

selectRevealInISeriesProjectView

public static final void selectRevealInISeriesProjectView(IResource resource,
                                                          boolean expandSelection)
Convenience method for calling selectRevealInISeriesProjectView against the current active workbench window.


Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.