Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.ws.service.policy.ui/src')
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/BaseOperationImpl.java233
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/IConManager.java251
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/PolicyOperationImpl.java121
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/QuickFixActionInfoImpl.java59
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ScrolledPageContent.java70
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePoliciesComposite.java1594
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyPlatformUIImpl.java202
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyRegistryUI.java299
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.java50
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.properties40
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/preferences/ServicePoliciesPreferencePage.java136
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePoliciesPropertyPage.java311
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePolicyPropertyTester.java21
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IEnableOperation.java36
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ILaunchOperation.java34
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IPolicyOperation.java160
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixAction.java33
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixActionInfo.java39
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyActivatorUI.java106
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyPlatformUI.java134
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ActivityUtils.java51
-rw-r--r--bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ServiceUtils.java58
22 files changed, 0 insertions, 4038 deletions
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/BaseOperationImpl.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/BaseOperationImpl.java
deleted file mode 100644
index 6b90f8c4e..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/BaseOperationImpl.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding of service policy
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.IStateEnumerationItem;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.ui.IEnableOperation;
-import org.eclipse.wst.ws.service.policy.ui.ILaunchOperation;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation.OperationKind;
-import org.eclipse.wst.ws.service.policy.utils.RegistryUtils;
-
-public class BaseOperationImpl
-{
- private String id;
- private IDescriptor descriptor;
- private OperationKind operationKind;
- private String policyIdPattern;
- private boolean multiSelect = false;
- private ILaunchOperation launchOperationObject;
- private IEnableOperation enableOperationObject;
- private String enumId;
- private IConfigurationElement enabledElement;
- private IConfigurationElement complexElement;
- private boolean workspaceOnly;
- private String defaultItem;
- private boolean useDefaultData;
-
- public String getId()
- {
- return id;
- }
-
- public void setId(String id)
- {
- this.id = id;
- }
- public boolean isWorkspaceOnly()
- {
- return workspaceOnly;
- }
-
- public void setWorkspaceOnly( boolean workspaceOnly )
- {
- this.workspaceOnly = workspaceOnly;
- }
-
- public void setSelection( boolean isIcon )
- {
- if( isIcon )
- {
- operationKind = OperationKind.iconSelection;
- }
- else
- {
- operationKind = OperationKind.selection;
- }
- }
-
- public IDescriptor getDescriptor()
- {
- return descriptor;
- }
-
- public OperationKind getOperationKind()
- {
- return operationKind;
- }
-
- public String getEnumerationId()
- {
- return enumId;
- }
-
- public void setEnumerationId( String enumId )
- {
- this.enumId = enumId;
- operationKind = OperationKind.enumeration;
- }
-
- public String getPolicyIdPattern()
- {
- return policyIdPattern;
- }
-
- public boolean isEnabled( List<IServicePolicy> selectedPolicies )
- {
- boolean result = true;
-
- // If we don't allow multi select and multiple policies have been selected
- // then this operation is not enabled.
- if( !multiSelect && selectedPolicies.size() > 1 )
- {
- result = false;
- }
-
- if( result && enabledElement != null )
- {
- // We have an extension for this enablement code so we will call this
- // code.
- if( enableOperationObject == null )
- {
- try
- {
- String enabledClassName = RegistryUtils.getAttributeName( enabledElement, "enabledclass" ); //$NON-NLS-1$
- enableOperationObject = (IEnableOperation)enabledElement.createExecutableExtension( enabledClassName );
- }
- catch( Exception exc )
- {
- ServicePolicyActivatorUI.logError( "Error loading service policy ui \"enabled\" class.", exc ); //$NON-NLS-1$
- }
-
- if( enableOperationObject != null )
- {
- result = enableOperationObject.isEnabled( selectedPolicies );
- }
- }
- }
-
- return result;
- }
-
- public void launchOperation( IServicePolicy thisPolicy, List<IServicePolicy> selectedPolicies )
- {
- if( launchOperationObject == null )
- {
- try
- {
- String launchClassName = RegistryUtils.getAttributeName( complexElement, "launchclass" ); //$NON-NLS-1$
- launchOperationObject = (ILaunchOperation)complexElement.createExecutableExtension( launchClassName );
- }
- catch( Exception exc )
- {
- ServicePolicyActivatorUI.logError( "Error loading service policy ui launch class.", exc ); //$NON-NLS-1$
- }
- }
-
- if( launchOperationObject != null )
- {
- launchOperationObject.launch( selectedPolicies );
- }
- }
-
- public boolean isMultiSelect()
- {
- return multiSelect;
- }
-
- public void setMultiSelect(boolean multiSelect)
- {
- this.multiSelect = multiSelect;
- }
-
- public void setDescriptor(IDescriptor descriptor)
- {
- this.descriptor = descriptor;
- }
-
- public void setPolicyIdPattern(String policyIdPattern)
- {
- this.policyIdPattern = policyIdPattern;
- }
-
- public void setEnabledElement(IConfigurationElement enabledElement)
- {
- this.enabledElement = enabledElement;
- }
-
- public void setComplexElement(IConfigurationElement complexElement)
- {
- this.complexElement = complexElement;
- operationKind = OperationKind.complex;
- }
-
- public void setDefaultItem( String defaultItem )
- {
- this.defaultItem = defaultItem;
- }
-
- public String getDefaultItem()
- {
- if( defaultItem == null )
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- List<IStateEnumerationItem> enumList = platform.getStateEnumeration( enumId );
-
- if( enumList != null )
- {
- defaultItem = enumList.get(0).getId();
-
- // No default item has been specified so we will search the enumeration for one.
- // If none was specified the first item in the enumeration is used.
- for( IStateEnumerationItem item : enumList )
- {
- if( item.isDefault() )
- {
- defaultItem = item.getId();
- break;
- }
- }
- }
- }
-
- return defaultItem;
- }
-
- public boolean isUseDefaultData()
- {
- return useDefaultData;
- }
-
- public void setUseDefaultData( boolean useDefaultData )
- {
- this.useDefaultData = useDefaultData;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/IConManager.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/IConManager.java
deleted file mode 100644
index 3694962bb..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/IConManager.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071025 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-import org.osgi.framework.Bundle;
-
-public class IConManager
-{
- private Map<String, Image> iconTable;
-
- public final String favorite = "fav"; //$NON-NLS-1$
- public final String invalid = "inv"; //$NON-NLS-1$
- public final String warning = "war"; //$NON-NLS-1$
- public final String lock = "loc"; //$NON-NLS-1$
-
- private String folderBaseURL;
- private String leafBaseURL;
- private Image favoriteImage;
- private Image invalidImage;
- private Image warningImage;
- private Image lockImage;
-
- private DecoratorDescriptor iconCreator;
-
- public IConManager()
- {
- iconTable = new HashMap<String, Image>();
- addOverlayIcons();
- iconCreator = new DecoratorDescriptor();
- }
-
- public String getFolderBaseUrl()
- {
- return folderBaseURL;
- }
-
- public String getLeafBaseUrl()
- {
- return leafBaseURL;
- }
-
- private void addOverlayIcons()
- {
- try
- {
- Bundle bundle = ServicePolicyActivatorUI.getDefault().getBundle();
- URL folderUrl = FileLocator.find( bundle, new Path( "icons/full/obj16/fldr_obj.gif" ), null ); //$NON-NLS-1$
- URL leafUrl = FileLocator.find( bundle, new Path( "icons/full/obj16/file_obj.gif" ), null ); //$NON-NLS-1$
- URL favoriteUrl = FileLocator.find( bundle, new Path( "icons/full/ovr16/favorite_ovr.gif" ), null ); //$NON-NLS-1$
- URL invalidUrl = FileLocator.find( bundle, new Path( "icons/full/ovr16/invalidtype_ovr.gif" ), null ); //$NON-NLS-1$
- URL warningUrl = FileLocator.find( bundle, new Path( "icons/full/ovr16/warning_ovr.gif" ), null ); //$NON-NLS-1$
- URL lockUrl = FileLocator.find( bundle, new Path( "icons/full/ovr16/unmodifiable_ovr.gif" ), null ); //$NON-NLS-1$
-
- getIconImage( folderUrl );
- getIconImage( leafUrl );
- favoriteImage = getIconImage( favoriteUrl );
- invalidImage = getIconImage( invalidUrl );
- warningImage = getIconImage( warningUrl );
- lockImage = getIconImage( lockUrl );
-
- folderBaseURL = folderUrl.toString();
- leafBaseURL = leafUrl.toString();
- }
- catch( Throwable exc )
- {
- ServicePolicyActivatorUI.logError( "Error reading icon overlays", exc ); //$NON-NLS-1$
- exc.printStackTrace();
- }
- }
-
- public boolean hasChanged( String[] string1, String[] string2 )
- {
- if( string1 == null || string2 == null || string1.length != string2.length ) return true;
-
- for( int index = 0; index < string1.length; index++ )
- {
- String value1 = string1[index];
- String value2 = string2[index];
-
- // We can do pointer comparison since we are using constant Strings.
- if( value1 != value2 )
- {
- return true;
- }
- }
-
- return false;
- }
-
- public Image getIconOverlay( String baseUrl, String[] overlays )
- {
- String imageUrl = getImageURL( baseUrl, overlays );
- Image result = (Image)iconTable.get( imageUrl );
-
- if( result == null )
- {
- Image baseImage = (Image)iconTable.get( baseUrl );
-
- if( baseImage == null )
- {
- // We need to load this baseImage
- try
- {
- baseImage = getIconImage( new URL( baseUrl ) );
- }
- catch( Exception exc )
- {
- ServicePolicyActivatorUI.logError( "Error loading image from:" + baseUrl, exc); //$NON-NLS-1$
- }
- }
-
- iconCreator.setBaseImage( baseImage, overlays );
-
- result = iconCreator.createImage();
- iconTable.put( imageUrl, result );
- }
-
- return result;
- }
-
- private boolean hasOverlay( String[] overlays, String value )
- {
- boolean result = false;
-
- for( String overlay : overlays )
- {
- // Note: We are using string pointer comparison here since, the strings
- // should only be the constants defined above.
- if( overlay == value )
- {
- result = true;
- break;
- }
- }
-
- return result;
- }
-
- private String getImageURL( String baseUrl, String[] overlays )
- {
- String url = baseUrl;
-
- for( String value : overlays )
- {
- if( value != null )
- {
- url = url + ":" + value; //$NON-NLS-1$
- }
- }
-
- return url;
- }
-
- public Image getIconImage( URL url )
- {
- String urlString = url.toString();
- Image image = iconTable.get( urlString );
-
- if( image == null )
- {
- ImageDescriptor imageDesc = ImageDescriptor.createFromURL(url);
-
- image = imageDesc.createImage();
- iconTable.put( urlString, image );
- }
-
- return image;
- }
-
- public void dispose()
- {
- for( Image image : iconTable.values() )
- {
- image.dispose();
- }
- }
-
- private class DecoratorDescriptor extends CompositeImageDescriptor
- {
- private Image baseImage;
- private Point size;
- private String[] overlays;
-
- protected void drawCompositeImage(int width, int height)
- {
- drawImage( baseImage.getImageData(), 0, 0);
-
- for( int index = 0; index < overlays.length; index++ )
- {
- if( hasOverlay(overlays, favorite) )
- {
- drawImage( favoriteImage.getImageData(), size.x - favoriteImage.getBounds().width, 0 );
- }
-
- if( hasOverlay( overlays, warning ) )
- {
- drawImage( warningImage.getImageData(), 0, size.y - warningImage.getBounds().height );
- }
-
- if( hasOverlay( overlays, invalid ) )
- {
- drawImage( invalidImage.getImageData(), 0, size.y - invalidImage.getBounds().height );
- }
-
- if( hasOverlay( overlays, lock ) )
- {
- drawImage( lockImage.getImageData(),
- size.x - lockImage.getBounds().width,
- size.y - lockImage.getBounds().height );
- }
- }
- }
-
- public void setBaseImage( Image image, String[] overlays )
- {
- Rectangle bounds = image.getBounds();
-
- this.baseImage = image;
- this.size = new Point( bounds.width, bounds.height );
- this.overlays = overlays;
- }
-
- protected Point getSize()
- {
- return size;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/PolicyOperationImpl.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/PolicyOperationImpl.java
deleted file mode 100644
index 46e762e02..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/PolicyOperationImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IPolicyState;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation;
-
-public class PolicyOperationImpl implements IPolicyOperation
-{
- private BaseOperationImpl baseOperation;
- private IServicePolicy policy;
-
- public PolicyOperationImpl( BaseOperationImpl baseOperation, IServicePolicy policy )
- {
- this.baseOperation = baseOperation;
- this.policy = policy;
- }
-
- public String getDefaultItem()
- {
- return baseOperation.getDefaultItem();
- }
-
- public IDescriptor getDescriptor()
- {
- return baseOperation.getDescriptor();
- }
-
- public String getEnumerationId()
- {
- return baseOperation.getEnumerationId();
- }
-
- public String getId()
- {
- return baseOperation.getId();
- }
-
- public OperationKind getOperationKind()
- {
- return baseOperation.getOperationKind();
- }
-
- public String getPolicyIdPattern()
- {
- return baseOperation.getPolicyIdPattern();
- }
-
- public boolean isEnabled( List<IServicePolicy> selectedPolicies )
- {
- return baseOperation.isEnabled( selectedPolicies );
- }
-
- public boolean isWorkspaceOnly()
- {
- return baseOperation.isWorkspaceOnly();
- }
-
- public void launchOperation( List<IServicePolicy> selectedPolicies)
- {
- baseOperation.launchOperation( policy, selectedPolicies );
- }
-
- public IServicePolicy getServicePolicy()
- {
- return policy;
- }
-
- public String getStateItem( IProject project )
- {
- IPolicyState state = getState( project );
- String key = baseOperation.getId();
- String defaultItem = baseOperation.getDefaultItem();
-
- if( baseOperation.isUseDefaultData() )
- {
- key = IPolicyState.DefaultValueKey;
- }
-
- if( defaultItem != null )
- {
- state.putDefaultValue( key, defaultItem, false );
- }
-
- return state.getValue( key );
- }
-
- public void setStateItem( IProject project, String stateItem )
- {
- IPolicyState state = getState( project );
- String key = baseOperation.getId();
-
- if( baseOperation.isUseDefaultData() )
- {
- key = IPolicyState.DefaultValueKey;
- }
-
- state.putValue( key, stateItem );
- }
-
- private IPolicyState getState( IProject project )
- {
- return project == null ? policy.getPolicyState() : policy.getPolicyState( project );
- }
-
- public boolean isUseDefaultData()
- {
- return baseOperation.isUseDefaultData();
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/QuickFixActionInfoImpl.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/QuickFixActionInfoImpl.java
deleted file mode 100644
index e78ffb3f9..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/QuickFixActionInfoImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixAction;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixActionInfo;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-
-public class QuickFixActionInfoImpl implements IQuickFixActionInfo
-{
- private IConfigurationElement element;
- private IDescriptor descriptor;
-
- public QuickFixActionInfoImpl( IConfigurationElement element, IDescriptor descriptor )
- {
- this.element = element;
- this.descriptor = descriptor;
- }
-
- public IQuickFixAction getAction()
- {
- IQuickFixAction result = null;
-
- try
- {
- Object action = element.createExecutableExtension( "class" ); //$NON-NLS-1$
-
- if( action instanceof IQuickFixAction )
- {
- result = (IQuickFixAction)action;
- }
- }
- catch( CoreException exc )
- {
- ServicePolicyActivatorUI.logError( "Error loading quick fix action.", exc ); //$NON-NLS-1$
- }
-
- return result;
- }
-
- public IDescriptor getDescriptor()
- {
- return descriptor;
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ScrolledPageContent.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ScrolledPageContent.java
deleted file mode 100644
index e33e08c61..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ScrolledPageContent.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- * 20080512 231161 pmoogk@ca.ibm.com - Peter Moogk, Fix tab key accessiblity problem.
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.SharedScrolledComposite;
-
-
-public class ScrolledPageContent extends SharedScrolledComposite {
-
- private FormToolkit fToolkit;
-
- public ScrolledPageContent(Composite parent) {
- this(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- }
-
- public ScrolledPageContent(Composite parent, int style) {
- super(parent, style);
-
- setFont(parent.getFont());
-
- fToolkit= getDialogsFormToolkit();
-
- setExpandHorizontal(true);
- setExpandVertical(true);
-
- Composite body= new Composite(this, SWT.NONE);
- body.setFont(parent.getFont());
- setContent(body);
- }
-
- public FormToolkit getDialogsFormToolkit() {
- if (fToolkit == null) {
- FormColors colors= new FormColors(Display.getCurrent());
- colors.setBackground(null);
- colors.setForeground(null);
- fToolkit= new FormToolkit(colors);
- }
- return fToolkit;
- }
-
- public void adaptChild(Control childControl) {
- // Need to have the track keyboard parameter false, since a true
- // value causes Composite controls to eat tab keys, which in turn
- // causes the whole preference page to become inaccessible.
- fToolkit.adapt(childControl, true, false);
- }
-
- public Composite getBody() {
- return (Composite) getContent();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePoliciesComposite.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePoliciesComposite.java
deleted file mode 100644
index e3c69e0c1..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePoliciesComposite.java
+++ /dev/null
@@ -1,1594 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071106 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- * 20071212 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- * 20080211 218520 pmoogk@ca.ibm.com - Peter Moogk
- * 20080324 222095 pmoogk@ca.ibm.com - Peter Moogk, UI now listens for state changes.
- * 20080324 223634 ericdp@ca.ibm.com - Eric D. Peters, Service Policies preference tree should be 3 level tree
- * 20080506 219005 ericdp@ca.ibm.com - Eric D. Peters, Service policy preference page not restoring properly
- * 20080530 234944 pmoogk@ca.ibm.com - Peter Moogk, Fixed focus problem for action controls
- * 20080716 239457 ericdp@ca.ibm.com - Eric D. Peters, Service Policy UI Restore defaults does not refresh validation error
- * 20090306 224632 ericdp@ca.ibm.com - Eric D. Peters, Fix Service Policies preference page UI
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IPolicyEnumerationList;
-import org.eclipse.wst.ws.service.policy.IPolicyRelationship;
-import org.eclipse.wst.ws.service.policy.IPolicyState;
-import org.eclipse.wst.ws.service.policy.IPolicyStateEnum;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.IStateEnumerationItem;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.listeners.IPolicyChildChangeListener;
-import org.eclipse.wst.ws.service.policy.listeners.IPolicyStateChangeListener;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyPlatformUI;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation.OperationKind;
-import org.eclipse.wst.ws.service.policy.ui.utils.ServiceUtils;
-import org.osgi.framework.Bundle;
-
-public class ServicePoliciesComposite extends Composite implements
- SelectionListener, IPolicyChildChangeListener {
-
- private ScrolledComposite operationsScrolledComposite;
- //a scrollable composite containing operations available for the selected policies
- private Composite operationsComposite;
- private IWorkbenchHelpSystem helpSystem;
- private Composite masterComposite;
- private Composite detailsComposite;
- private Tree masterPolicyTree;
- //tertiary and higher level policy nodes in a separate tree
- private Tree detailsPolicyTree;
- private Text text_DetailsPanel_description;
- private Text text_DetailsPanel_dependencies;
- private Label label_DetailsPanel_description;
- private Label label_detailsPanel_dependancies;
- private Hashtable<String, IStatus> allErrors;
- private IStatus error;
- private boolean bComplexOpCompleted = true;
- private List<ChildChangeEvent> listChildChangeEvents;
- private IConManager iconManager = new IConManager();
- private IProject project = null;
- private SelectionListener listener;
- private ExpandableComposite excomposite;
- private ServicePolicyPlatform platform = ServicePolicyPlatform
- .getInstance();
- private ServicePolicyPlatformUI platformUI = ServicePolicyPlatformUI
- .getInstance();
- private IPolicyStateChangeListener stateChangeListener = new StateChangeListener();
- private boolean stateChangeEnabled = true;
- private HashSet<IServicePolicy> stateChangePolicySet = new HashSet<IServicePolicy>();
- private List<IServicePolicy> lastSelectedSp = null;
- /*CONTEXT_ID PTPP0001 for the Service Policies Preference & Property Page*/
- private String INFOPOP_SPPP_PAGE = ServicePolicyActivatorUI.PLUGIN_ID + ".SPPP0001";
-
- /**
- * Creates an expandable composite
- * @param parent
- * @param nColumns
- * @return
- */
- private ExpandableComposite createExpandableComposite(Composite parent,
- int nColumns) {
- ExpandableComposite excomposite = new ExpandableComposite(parent,
- SWT.NONE, ExpandableComposite.TWISTIE
- | ExpandableComposite.CLIENT_INDENT);
- excomposite.setExpanded(false);
- excomposite.setVisible(false);
- excomposite.setFont(JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT));
- excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
- true, false, nColumns, 1));
- excomposite.addExpansionListener(new ExpansionAdapter() {
- public void expansionStateChanged(ExpansionEvent e) {
- expandedStateChanged((ExpandableComposite) e.getSource());
- }
- });
- makeScrollableCompositeAware(excomposite);
- return excomposite;
- }
-
- /**
- * @author ericdp
- * Helper class that encapsulates data required when an action control changes state
- *
- */
- private class ActionControlData {
- private List<IServicePolicy> spList;
- private List<IPolicyOperation> poList;
-// private IPolicyOperation po;
-
- public ActionControlData(List<IServicePolicy> spList, List<IPolicyOperation> poList) {
- this.spList = spList;
- this.poList = poList;
- }
- public List<IServicePolicy> getSpList() {
- return spList;
- }
-
- public void setSpList(List<IServicePolicy> spList) {
- this.spList = spList;
- }
-//
-// public IPolicyOperation getPo() {
-// return po;
-// }
-//
-// public void setPo(IPolicyOperation po) {
-// this.po = po;
-// }
-
- public List<IPolicyOperation> getPoList() {
- return poList;
- }
-
- public void setPoList(List<IPolicyOperation> poList) {
- this.poList = poList;
- }
- }
-
- /**
- * Makes the scrollable composite aware of this control, so expand/collapse
- * of the scrollable composite will move this control down/up accordingly
- * @param control the control to make the scrollable composite aware of
- */
- private void makeScrollableCompositeAware(Control control) {
- ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(control);
- if (parentScrolledComposite != null) {
- parentScrolledComposite.adaptChild(control);
- }
- }
-
- private ScrolledPageContent getParentScrolledComposite(Control control) {
- Control parent = control.getParent();
- while (!(parent instanceof ScrolledPageContent) && parent != null) {
- parent = parent.getParent();
- }
- if (parent instanceof ScrolledPageContent) {
- return (ScrolledPageContent) parent;
- }
- return null;
- }
-
- private final void expandedStateChanged(ExpandableComposite expandable) {
- ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(expandable);
- if (parentScrolledComposite != null) {
- parentScrolledComposite.reflow(true);
- }
- }
-
- /**
- * @param parent
- * @return a scrollable composite containing an expandable content
- *
- */
- private Composite createDetailsScrollPageContent(Composite parent) {
-
- int nColumns = 1;
-
- final ScrolledPageContent pageContent = new ScrolledPageContent(parent);
-
- GridLayout pageContLayout = new GridLayout();
- pageContLayout.numColumns = nColumns;
- pageContLayout.marginHeight = 0;
- pageContLayout.marginWidth = 0;
-
- Composite composite = pageContent.getBody();
- composite.setLayout(pageContLayout);
-
- excomposite = createExpandableComposite(composite, nColumns);
-
- Composite inner = new Composite(excomposite, SWT.NONE);
- inner.setFont(composite.getFont());
- inner.setLayout(new GridLayout(nColumns, false));
- excomposite.setClient(inner);
- //details policy tree for tertiary and higher level service policies
- detailsPolicyTree = new Tree(inner, SWT.BORDER | SWT.MULTI);
- detailsPolicyTree.addSelectionListener(this);
- GridData detailsPrefTreeGD = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- detailsPrefTreeGD.heightHint = 50;
- detailsPolicyTree.setLayoutData(detailsPrefTreeGD);
- detailsPolicyTree.setToolTipText(WstSPUIPluginMessages.TOOLTIP_PSP_DETAILSTREE);
- //make the scrollable composite aware of the tree so expand/collapse works properly
- makeScrollableCompositeAware(detailsPolicyTree);
-
- createPolicyOperationsComposite(composite);
- Composite descriptionAndDetailsComposite = new Composite(composite, SWT.NONE);
- descriptionAndDetailsComposite.setFont(composite.getFont());
- GridLayout layout = new GridLayout(nColumns, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
-
-
- descriptionAndDetailsComposite.setLayout(layout);
- GridData detailsGD4 = new GridData(SWT.FILL, SWT.END, true, true);
-
- descriptionAndDetailsComposite.setLayoutData(detailsGD4);
- makeScrollableCompositeAware(descriptionAndDetailsComposite);
- label_DetailsPanel_description = new Label(descriptionAndDetailsComposite, SWT.NONE);
- GridData detailsGD2 = new GridData(SWT.FILL, SWT.END, true, true);
- label_DetailsPanel_description.setLayoutData(detailsGD2);
- label_DetailsPanel_description
- .setText(WstSPUIPluginMessages.LABEL_SERVICEPOLICIES_DESCRIPTION);
- makeScrollableCompositeAware(label_DetailsPanel_description);
- text_DetailsPanel_description = new Text(descriptionAndDetailsComposite, SWT.WRAP
- | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
- GridData detailsGD = new GridData(SWT.FILL, SWT.END, true, true);
- detailsGD.heightHint = 75;
- detailsGD.widthHint = 220;
- text_DetailsPanel_description.setLayoutData(detailsGD);
- text_DetailsPanel_description.setToolTipText(WstSPUIPluginMessages.TOOLTIP_PSP_DESCRIPTION);
-
- makeScrollableCompositeAware(text_DetailsPanel_description);
- label_detailsPanel_dependancies = new Label(descriptionAndDetailsComposite, SWT.NONE);
- GridData detailsGD3 = new GridData(SWT.FILL, SWT.END, true, true);
- label_detailsPanel_dependancies.setLayoutData(detailsGD3);
- makeScrollableCompositeAware(label_detailsPanel_dependancies);
- label_detailsPanel_dependancies
- .setText(WstSPUIPluginMessages.LABEL_SERVICEPOLICIES_DEPENDENCIES);
- text_DetailsPanel_dependencies = new Text(descriptionAndDetailsComposite, SWT.WRAP
- | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
- text_DetailsPanel_dependencies.setToolTipText(WstSPUIPluginMessages.TOOLTIP_PSP_DEPENDENCIES);
- makeScrollableCompositeAware(text_DetailsPanel_dependencies);
-
-
- composite.setLayout(pageContLayout);
- GridData dependenciesGD = new GridData(SWT.FILL, SWT.END, true, true);
- dependenciesGD.heightHint = 75;
- dependenciesGD.widthHint = 220;
- text_DetailsPanel_dependencies.setLayoutData(dependenciesGD);
-
- return pageContent;
- }
-
- /**
- * Creates the scrollable composite that will contain widgets associated with a policy operation
- * @param parent the parent composite
- */
- private void createPolicyOperationsComposite(Composite parent) {
- operationsScrolledComposite = new ScrolledComposite(parent,
- SWT.H_SCROLL | SWT.V_SCROLL);
- operationsScrolledComposite.setExpandHorizontal(true);
- operationsScrolledComposite.setExpandVertical(true);
- GridData operationsScrolledCompositeGD = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- operationsScrolledCompositeGD.heightHint =75;
- operationsScrolledComposite.setLayoutData(operationsScrolledCompositeGD);
- operationsComposite = new Composite(operationsScrolledComposite,
- SWT.NONE);
- operationsScrolledComposite.setContent(operationsComposite);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
-
- operationsComposite.setLayout(layout);
- operationsScrolledComposite.setMinSize(operationsComposite.computeSize(
- 400, 100));
- makeScrollableCompositeAware(operationsScrolledComposite);
- makeScrollableCompositeAware(operationsComposite);
- }
-
- public ServicePoliciesComposite(Composite parent, IProject project,
- SelectionListener listener) {
-
- super(parent, SWT.NONE);
- this.project = project;
- this.listener = listener;
- allErrors = new Hashtable<String, IStatus>();
- helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout parentLayout = new GridLayout();
- parentLayout.numColumns = 2;
- parentLayout.horizontalSpacing = 0;
-
- this.setLayout(parentLayout);
- this.setLayoutData(new GridData(GridData.FILL_BOTH));
- Label description = new Label(this, SWT.NONE);
- description.setText(WstSPUIPluginMessages.LABEL_SERVICEPOLICIES_PAGE_DESCRIPTION);
- GridData descGD = new GridData(SWT.BEGINNING, SWT.TOP, false, false, 2,1 );
- description.setLayoutData(descGD);
- masterComposite = new Composite(this, SWT.NONE);
-
- GridLayout masterLayout = new GridLayout();
- masterLayout.numColumns = 1;
- masterLayout.horizontalSpacing = 0;
- masterComposite.setLayout(masterLayout);
- masterComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- detailsComposite = new Composite(this, SWT.NONE);
- GridLayout detailsLayout = new GridLayout();
- detailsLayout.numColumns = 1;
- detailsLayout.horizontalSpacing = 0;
- detailsComposite.setLayout(detailsLayout);
- detailsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- masterPolicyTree = new Tree(masterComposite, SWT.BORDER | SWT.MULTI);
- masterPolicyTree.setLayoutData(new GridData(GridData.FILL_VERTICAL));
- masterPolicyTree.setToolTipText(WstSPUIPluginMessages.TOOLTIP_PSP_TREE);
-
- Composite othersComposite = createDetailsScrollPageContent(detailsComposite);
- GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
- true);
- othersComposite.setLayoutData(gridData);
-
- masterPolicyTree.addSelectionListener(this);
-
- List<IServicePolicy> policyList = platform.getRootServicePolicies(null);
-
- policyList = ServiceUtils.sortList( policyList );
-
- for (IServicePolicy policy : policyList) {
- addPolicy(policy, masterPolicyTree, true);
- }
- TreeItem[] treeItems = masterPolicyTree.getItems();
- if (treeItems.length > 0) {
- //select the first item in the tree & fire event so UI is updated
- masterPolicyTree.setSelection(treeItems[0]);
- masterPolicyTree.notifyListeners(SWT.Selection, new Event());
- }
- }
-
- /**
- * Sets the image on ti, if associated service policy defines an icon
- * it will will be used, otherwise default Folder/Leaf icons will be used
- * @param ti the TreeItem to set the image for
- * @param sp the service policy associated with ti
- * @param iconOverlays description of which overlays should be applied
- */
- private void setImage(TreeItem ti, IServicePolicy sp, String[] iconOverlays) {
- Image i = (sp.getChildren().size() == 0) ? iconManager.getIconOverlay(
- iconManager.getLeafBaseUrl(), iconOverlays) : iconManager
- .getIconOverlay(iconManager.getFolderBaseUrl(), iconOverlays);
- if (sp.getDescriptor() != null) {
- String iconPathBundleID = null;
- String iconPath = null;
- iconPathBundleID = sp.getDescriptor().getIconBundleId();
- iconPath = sp.getDescriptor().getIconPath();
- if (iconPathBundleID != null && iconPath != null
- && iconPathBundleID.length() > 0 && iconPath.length() > 0) {
- Bundle b = Platform.getBundle(iconPathBundleID);
- i = iconManager.getIconOverlay(FileLocator.find(b,
- new Path(iconPath), null).toString(), iconOverlays);
- }
- }
- ti.setImage(i);
- // image has changed, notify change listeners so tree gets updated
- ti.notifyListeners(SWT.Modify, new Event());
- }
-
- private boolean is4thLevelOrHigherPolicy (IServicePolicy sp) {
- return sp.getParentPolicy() != null
- && sp.getParentPolicy().getParentPolicy() != null && sp.getParentPolicy().getParentPolicy().getParentPolicy() != null;
-
- }
-
- private boolean is3rdLevelPolInMasterTreeWithChildren (List<IServicePolicy> spListInMasterTree) {
- return spListInMasterTree.get(0).getParentPolicy() != null && spListInMasterTree.get(0).getParentPolicy().getParentPolicy() != null
- && spListInMasterTree.get(0).getChildren().size() > 0 ;
- }
- /**
- * Add service policy sp and children of sp to the parent
- * @param sp the service policy to add
- * @param parent either a Tree (masterPolicyTree or DetailsPolicyTree), or a TreeItem
- * to add service policy children to
- * @param addUpToLevel3Only false if should add 4th and higher level
- * child policies
- */
- private void addPolicy(IServicePolicy sp, Widget parent,
- boolean addUpToLevel3Only) {
- sp.addPolicyChildChangeListener(this);
- addStateListener( sp );
- if (addUpToLevel3Only && is4thLevelOrHigherPolicy(sp) )
- // don't add 4th level and higher branches, these are added on demand
- // to a different tree
- return;
- TreeItem ti;
- if (parent instanceof TreeItem)
- ti = new TreeItem((TreeItem) parent, SWT.NONE);
- else
- ti = new TreeItem((Tree) parent, SWT.NONE);
- ti.setText(sp.getDescriptor().getLongName());
- ti.setData(sp);
-
- setImage(ti, sp, getIconOverlayInfo(sp, false));
- List<IServicePolicy> childrenPolicyList = sp.getChildren();
-
- childrenPolicyList = ServiceUtils.sortList( childrenPolicyList );
-
- for (IServicePolicy policy : childrenPolicyList) {
- addPolicy(policy, ti, addUpToLevel3Only);
- }
-
- }
-
- /**
- * Returns icon overlay information
- * @param sp the service policy that should have some overlay images associated with it
- * @param invalid true if the service policy is valid
- * @return String[] containing information about what overlays to apply to the icon that
- * is associated with sp
- */
- private String[] getIconOverlayInfo(IServicePolicy sp, boolean invalid) {
- String[] overLays = new String[4];
-
- IPolicyState polState = (project == null) ? sp.getPolicyState() : sp
- .getPolicyState(project);
- IPolicyStateEnum polEnum = (project == null) ? sp.getPolicyStateEnum()
- : sp.getPolicyStateEnum(project);
- if (!polState.isMutable())
- overLays[0] = iconManager.lock;
- if ((sp.getStatus() != null && sp.getStatus().getSeverity() == IStatus.ERROR) || invalid)
- overLays[1] = iconManager.invalid;
- if ((sp.getStatus() != null && sp.getStatus().getSeverity() == IStatus.WARNING))
- overLays[2] = iconManager.warning;
- if (polEnum != null) {
- if (polEnum.getEnumId().equals(
- "org.eclipse.wst.service.policy.booleanEnum")) { //$NON-NLS-1$
- if (policyHasIconSelectionOperationSelected(sp))
- overLays[3] = iconManager.favorite;
- }
-
- }
- return overLays;
- }
-
- /**
- * @param sp
- */
- private boolean policyHasIconSelectionOperationSelected(IServicePolicy sp) {
- boolean iconSelectionOperationSelected = false;
- List<IPolicyOperation> operationList = platformUI.getOperations(sp, project == null);
- for (IPolicyOperation operationItem : operationList) {
- if (operationItem.getOperationKind().equals(OperationKind.iconSelection)) {
- String stateID = operationItem.getStateItem(project);
- if (stateID.equals("org.eclipse.wst.true")) //$NON-NLS-1$
- return true;
- }
-
- }
- return iconSelectionOperationSelected;
- }
-
- /**
- * Does anything necessary because the default button has been pressed.
- */
- public void performDefaults() {
- initializeDefaults();
- List<IServicePolicy> policyList = platform.getRootServicePolicies(null);
-
- policyList = ServiceUtils.sortList( policyList );
- masterPolicyTree.removeAll();
-
- for (IServicePolicy policy : policyList) {
- addPolicy(policy, masterPolicyTree, true);
- }
- TreeItem[] treeItems = masterPolicyTree.getItems();
- if (treeItems.length > 0) {
- //select the first item in the tree & fire event so UI is updated
- masterPolicyTree.setSelection(treeItems[0]);
- masterPolicyTree.notifyListeners(SWT.Selection, new Event());
- error = validateAllPolicies((IServicePolicy)treeItems[0].getData());
- }
-
- }
- private class ChildChangeEvent {
- public ChildChangeEvent(List<IServicePolicy> changedChildren, List<Boolean> added ) {
- this.changedChildren = changedChildren;
- this.added = added;
-
- }
- private List<IServicePolicy> changedChildren;
- private List<Boolean> added;
- public List<IServicePolicy> getChangedChildren() {
- return changedChildren;
- }
- public void setChangedChildren(List<IServicePolicy> changedChildren) {
- this.changedChildren = changedChildren;
- }
- public List<Boolean> getAdded() {
- return added;
- }
- public void setAdded(List<Boolean> added) {
- this.added = added;
- }
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.ws.service.policy.listeners.IPolicyChildChangeListener#childChange(List<org.eclipse.wst.ws.service.policy.IServicePolicy>, List<java.lang.Boolean>)
- */
- public void childChange( List<IServicePolicy> child, List<Boolean> added ) {
- //ignore events unless we are in a complex operation
- if (!bComplexOpCompleted)
- //cache the event until complex operation completed
- listChildChangeEvents.add(new ChildChangeEvent(child, added));
-
- }
-
-
- /**
- * @param child
- * @param added
- */
- private void processChildChangeEvent(ChildChangeEvent cce,
- Hashtable<String, IServicePolicy> htTopLevelAddtions) {
- List<IServicePolicy> changedServicePolicyList = cce.getChangedChildren();
- List<Boolean> changedServicePolicyAddedList = cce.getAdded();
- for (int i = 0; i < changedServicePolicyList.size(); i++) {
- IServicePolicy nextChangedServicePolicy = changedServicePolicyList.get(i);
- boolean added = changedServicePolicyAddedList.get(i);
- if (!added) {
- //delete node
- processChildChangeEventRemoveServicePolicy(nextChangedServicePolicy);
- } else {
- //an addition, only process top level additions as this is a recursive operation (adds children too)
- if (htTopLevelAddtions.containsKey(nextChangedServicePolicy.getId())) {
- processChildChangeEventAddServicePolicy(nextChangedServicePolicy);
- }
- }
- }
- }
-
-
- /**
- * @param nextChangedServicePolicy
- */
- private void processChildChangeEventRemoveServicePolicy(IServicePolicy nextChangedServicePolicy) {
- boolean is4thLevelOrHigher = is4thLevelOrHigherPolicy(nextChangedServicePolicy);
-
- removeStateListener( nextChangedServicePolicy );
-
- if (is4thLevelOrHigher) {
- if (detailsPolicyTree.isVisible()) {
- TreeItem[] children = detailsPolicyTree.getItems();
- TreeItem found = null;
- for (int i=0; i < children.length; i++) {
- found = findPolicy(nextChangedServicePolicy, children[i]);
- if (found != null)
- break;
- }
- if (found != null && !found.isDisposed()) {
- processChildChangeEventDeleteTreeItem(found);
- }
- }
- } else {
- TreeItem[] children = masterPolicyTree.getItems();
- TreeItem found = null;
- for (int i=0; i < children.length; i++) {
- found = findPolicy(nextChangedServicePolicy, children[i]);
- if (found != null)
- break;
- }
- if (found != null && !found.isDisposed()) {
- processChildChangeEventDeleteTreeItem(found);
-
- }
-
-
-
- }
-
- }
-
- /**
- * Delete the item, and choose set a new selection as appropriate from one of the policy trees
- * @param deleteItem
- */
- private void processChildChangeEventDeleteTreeItem(TreeItem deleteItem) {
- Tree parentTree = deleteItem.getParent();
- Tree selectionTree = parentTree;
- TreeItem parentTreeItem = deleteItem.getParentItem();
- //index of found in the tree
- int idx = (parentTreeItem == null) ? parentTree.indexOf(deleteItem) : parentTreeItem.indexOf(deleteItem);
- //is index the last index in the tree
- boolean isLastIndex = (parentTreeItem == null) ? parentTree.indexOf(deleteItem) == parentTree.getItemCount() -1 : parentTreeItem.indexOf(deleteItem) == parentTreeItem.getItemCount() -1;
- //number of siblings
- int siblingsCount = (parentTreeItem == null) ? parentTree.getItemCount() -1 : parentTreeItem.getItemCount() -1;
- boolean hasParent = (parentTreeItem == null) ? parentTree.getItemCount() == 0 : parentTreeItem.getItemCount() == 0;
- deleteItem.dispose();
- parentTree.redraw();
- TreeItem selectItem = null;
- if (siblingsCount == 0) {
- if (hasParent) {
- //no siblings, select parent
- if (parentTreeItem == null)
- selectItem = parentTree.getItem(0);
- else
- selectItem = parentTreeItem;
- } else {
- if (parentTree == detailsPolicyTree)
- //select something from master tree
- if (masterPolicyTree.getItems().length > 0) {
- selectItem = masterPolicyTree.getItem(0);
- selectionTree = masterPolicyTree;
- }
-
- }
-
- } else {
- if (parentTreeItem == null) {
- if (isLastIndex)
- selectItem = parentTree.getItem(idx -1);
- else
- selectItem = parentTree.getItem(idx);
- } else {
- if (isLastIndex)
- selectItem = parentTreeItem.getItem(idx -1);
- else
- selectItem = parentTreeItem.getItem(idx);
-
- }
- }
- if (selectItem != null) {
- selectionTree.setSelection(selectItem);
- selectionTree.notifyListeners(SWT.Selection, new Event());
- }
- }
-
- /**
- * @param policyToAdd
- */
- private void processChildChangeEventAddServicePolicy(IServicePolicy policyToAdd) {
- boolean is4thLevelOrHigher = is4thLevelOrHigherPolicy(policyToAdd);
- IServicePolicy parent = policyToAdd.getParentPolicy();
- if (is4thLevelOrHigher) {
- if (detailsPolicyTree.isVisible()) {
- TreeItem[] children = detailsPolicyTree.getItems();
- TreeItem found = null;
- for (int i=0; i < children.length; i++) {
- found = findPolicy(parent, children[i]);
- if (found != null)
- break;
- }
- if (found != null && !found.isDisposed()) {
- addPolicy(policyToAdd, found, false);
- }
- }
- } else {
- //less than 4th level policy
- TreeItem[] children = masterPolicyTree.getItems();
- TreeItem found = null;
- for (int i=0; i < children.length; i++) {
- found = findPolicy(parent, children[i]);
- if (found != null)
- break;
- }
- if (found != null && !found.isDisposed()) {
- addPolicy(policyToAdd, found, false);
-
- }
- }
- }
-
- /**
- * Find the policy within the tree ti
- * @param policyToFind
- */
- private TreeItem findPolicy(IServicePolicy policyToFind, TreeItem ti) {
- TreeItem toReturn = null;
- if (ti == null || !(ti.getData() instanceof IServicePolicy))
- return toReturn;
- IServicePolicy sp = (IServicePolicy)ti.getData();
- if (sp.getId().equals(policyToFind.getId()))
- return ti;
- else {
- TreeItem[] tiChildren = ti.getItems();
- for (int i =0; i < tiChildren.length; i++) {
- toReturn = findPolicy(policyToFind, tiChildren[i]);
- if (toReturn != null)
- break;
- }
- }
- return toReturn;
- }
- /**
- * Initializes states of the controls using default values in the preference
- * store.
- */
- private void initializeDefaults() {
- if (project == null)
- platform.restoreDefaults();
- else
- platform.restoreDefaults(project);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- if (e.getSource() == masterPolicyTree || e.getSource() == detailsPolicyTree) {
- TreeItem[] selectedItems;
- if (e.getSource() == masterPolicyTree)
- selectedItems = masterPolicyTree.getSelection();
- else
- selectedItems = detailsPolicyTree.getSelection();
- //possible that an event is fired and no nodes selected
- if (!(selectedItems.length > 0))
- return;
- List<IServicePolicy> sp = new Vector<IServicePolicy>();
- for (int i = 0; i < selectedItems.length; i++) {
- sp.add((IServicePolicy) selectedItems[i].getData());
- }
- //update the context sensitive help
- updateCSH(sp);
- updateInfoPanels(sp);
-
- if (e.getSource() == masterPolicyTree) {
- // if selected node in master tree is 3rd level & has
- // children, populate details tree
- if (is3rdLevelPolInMasterTreeWithChildren(sp)) {
- populateDetailsPolicyTree(sp);
- } else {
- //if expandable composite was visible, collapse and set invisible
- if (excomposite.getVisible()) {
- excomposite.setVisible(false);
- excomposite.setExpanded(false);
- expandedStateChanged(excomposite);
- }
- }
- }
- addActionButtons(sp);
- lastSelectedSp = sp;
-
- } else {
- // an action control fired a change event
- Control actionControl = (Control) e.getSource();
- Object oldData = actionControl.getData();
-
- updatePolicy(actionControl);
-
- if( lastSelectedSp != null )
- {
- addActionButtons(lastSelectedSp);
- }
-
- //policy updates might delete nodes in the tree, so make sure action control not disposed
- IServicePolicy changedSP = null;
- if (!actionControl.isDisposed())
- changedSP = ((ActionControlData) actionControl.getData())
- .getSpList().get(0);
- error = validateAllPolicies(changedSP);
- //inform listeners that a control has changed, as composite may be in error now
- listener.widgetSelected(e);
-
- setFocusForLastControl( oldData );
- }
- }
-
- // The UI is continually recreating the action buttons, so the focus is
- // is lost when an action button is selected. This method attempts
- // to find the newly created control that is associated with operation
- // that was previously selected. The focus is then reestablished for this
- // control.
- private void setFocusForLastControl( Object oldData )
- {
- if( oldData != null && oldData instanceof ActionControlData )
- {
- ActionControlData controlData = (ActionControlData)oldData;
- IPolicyOperation operation = controlData.getPoList().get(0);
- Control[] compositeControls = operationsComposite.getChildren();
-
- for( Control newControl : compositeControls )
- {
- Object newData = newControl.getData();
-
- if( newData != null && newData instanceof ActionControlData )
- {
- IPolicyOperation newOperation = ((ActionControlData)newData).poList.get(0);
-
- if( newOperation == operation )
- {
- newControl.setFocus();
- break;
- }
- }
- }
- }
- }
-
- /**
- * Populate the details policy tree with sp and their children
- * @param sp a list of top level details tree service policies
- */
- private void populateDetailsPolicyTree(List<IServicePolicy> sp) {
- List<IServicePolicy> childpolicyList = sp.get(0)
- .getChildren();
- detailsPolicyTree.removeAll();
- for (IServicePolicy policy : childpolicyList) {
- addPolicy(policy, detailsPolicyTree, false);
- }
- // update details preference tree
- TreeItem[] treeItems = detailsPolicyTree.getItems();
- for (int i = 0; i < treeItems.length; i++) {
- updateValidStates(treeItems[i], true);
- }
-
- excomposite.setVisible(true);
- excomposite.setText(sp.get(0).getDescriptor().getLongName()
- + " (" + WstSPUIPluginMessages.TEXT_DETAILS + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- // text has changed, so need to force layout so updated
- excomposite.layout();
- }
-
- /**
- * Updates the details and dependencies panels for the first service
- * policy in spList
- * @param spList a list of selected service policies
- */
- private void updateInfoPanels(List<IServicePolicy> spList) {
- String desc = (spList.get(0) == null
- || spList.get(0).getDescriptor() == null || spList.get(0)
- .getDescriptor().getDescription() == null) ? "" : spList.get(0) //$NON-NLS-1$
- .getDescriptor().getDescription();
- text_DetailsPanel_description.setText(desc);
- text_DetailsPanel_dependencies.setText(getDependanciesText(spList
- .get(0)));
- }
-
- /**
- * Updates the context sensitive help for the composite with
- * that defined for the first policy in spList (or a parent of
- * first policy in spList policy does not define any CSH)
- * @param spList the list of selected service policies
- */
- private void updateCSH(List<IServicePolicy> spList) {
- String CSH_ID = (spList.get(0) == null || spList.get(0).getDescriptor() == null) ? null
- : spList.get(0).getDescriptor().getContextHelpId();
- IServicePolicy parentSP = spList.get(0);
- while ((CSH_ID == null || CSH_ID.length() == 0)) {
- parentSP = parentSP.getParentPolicy();
- if (parentSP == null)
- break;
- CSH_ID = (parentSP.getDescriptor() == null) ? null : parentSP
- .getDescriptor().getContextHelpId();
- }
- if (CSH_ID == null)
- CSH_ID = INFOPOP_SPPP_PAGE;
- helpSystem.setHelp(this, CSH_ID);
- }
-
- /**
- * Validates all Service Policies in the model
- *
- * @param IServicePolicy
- * the focus policy, i.e. one that changed state
- * @return IStatus null if no Service policies in error, otherwise a Service
- * Policy error (the focucPolicy error if it is in error).
- * Postcondition- the error property is updated.
- */
- private IStatus validateAllPolicies(IServicePolicy focusPolicy) {
- // remove all errors as going to re-validate
- allErrors.clear();
- // re-validate all policies in model
- List<IServicePolicy> servicePolicyList = platform
- .getRootServicePolicies(null);
- for (IServicePolicy servicePolicyItem : servicePolicyList) {
- validatePolicy(servicePolicyItem);
- }
- // get the error for the selected/focusPolicy
- IStatus error = (focusPolicy == null) ? null : allErrors
- .get(focusPolicy.getId());
- //if there was no error for the selected/focusPolicy, get the first error in the list of errors
- if (error == null)
- if (!allErrors.isEmpty())
- error = allErrors.get(allErrors.keys().nextElement());
-
- // update master policy tree nodes denoting node error status
- TreeItem[] treeItems = masterPolicyTree.getItems();
- for (int i = 0; i < treeItems.length; i++) {
- updateValidStates(treeItems[i], false);
- }
- if (detailsPolicyTree.isVisible()) {
- // update details preference tree nodes denoting node error status
- treeItems = detailsPolicyTree.getItems();
- for (int i = 0; i < treeItems.length; i++) {
- updateValidStates(treeItems[i], false);
- }
-
- }
- return error;
- }
-
- /**
- * Updates the policy trees to reflect valid or invalid states, invalid states are
- * propagated up through the tree, and up to master tree if updateDetailsOnly is false
- * @param ti the TreeItem to update, updates ti and all it's children
- * @param updateDetailsOnly if false then propagate invalid states into
- * master tree
- */
- private void updateValidStates(TreeItem ti, boolean updateDetailsOnly) {
- // assume tree item is valid for now
- IServicePolicy sp = (IServicePolicy) ti.getData();
- setValidPolicyState(ti);
-
- if (allErrors.containsKey(sp.getId()))
- setInvalidPolicyState(ti, updateDetailsOnly);
- TreeItem[] treeItems = ti.getItems();
- if (ti.getItems().length == 0) {
- if (sp.getChildren().size() != 0 && policyChildrenInvalid(sp))
- setInvalidPolicyState(ti, updateDetailsOnly);
- } else {
- for (int i = 0; i < treeItems.length; i++) {
-
- updateValidStates(treeItems[i], updateDetailsOnly);
- }
- }
-
- }
-
- /**
- * Checks whether the sp has invalid children
- * @param sp the service policy whose children may be invalid
- * @return true if sp has an invalid child
- */
- private boolean policyChildrenInvalid(IServicePolicy sp) {
- boolean toReturn = false;
- List<IServicePolicy> servicePolicyList = sp.getChildren();
- for (IServicePolicy servicePolicyItem : servicePolicyList) {
- if (allErrors.containsKey(servicePolicyItem.getId()))
- return true;
- else
- toReturn = policyChildrenInvalid(servicePolicyItem);
- }
- return toReturn;
- }
-
- /**
- * Validates the Service Policies for the sp and all it's children, creating
- * error status objects for any unsatisfied relationships
- *
- * @param sp
- * the service policy to validate
- */
- private void validatePolicy(IServicePolicy sp) {
- String operationLongName;
- String operationSelectionLongName;
- String dependantPolicyShortName;
- List<IPolicyRelationship> relationShipList = sp.getRelationships();
- String currentValueID = null;
- if (relationShipList != null && relationShipList.size() > 0) {
- for (IPolicyRelationship relationShipItem : relationShipList) {
- //operations for the policy
- List<IPolicyOperation> policyOperationsList = platformUI
- .getOperations(relationShipItem.getPolicyEnumerationList()
- .getPolicy(), project == null);
- //default operation name
- operationLongName = ""; //$NON-NLS-1$
- for (IPolicyOperation policyOperationItem : policyOperationsList) {
- if (policyOperationItem.isUseDefaultData()) {
- operationLongName = policyOperationItem.getDescriptor()
- .getLongName();
- currentValueID = policyOperationItem.getStateItem(project);
- break;
- }
- }
- // a list of states
- List<IStateEnumerationItem> spStateEnumerationList = relationShipItem
- .getPolicyEnumerationList().getEnumerationList();
- // a list of related policies and their acceptable states to satisfy a stateEnumerationItem in spStateEnumerationList
- List<IPolicyEnumerationList> relatedPolicies = relationShipItem
- .getRelatedPolicies();
- for (IStateEnumerationItem stateEnumerationItem : spStateEnumerationList) {
- if (stateEnumerationItem.getId() != currentValueID)
- continue;
- //long name of the related policy operation
- operationSelectionLongName = stateEnumerationItem.getLongName();
- for (IPolicyEnumerationList relatedPolicyEnumerationItem : relatedPolicies) {
- dependantPolicyShortName = relatedPolicyEnumerationItem
- .getPolicy().getDescriptor().getShortName();
- //the list of related sp states that satisfy the stateEnumerationItem
- List<IStateEnumerationItem> relatedSPStateEnumerationList = relatedPolicyEnumerationItem
- .getEnumerationList();
- //the list of valid ids for the related service policy operation
- List<String> validIds = new Vector<String>();
- for (int i = 0; i < relatedSPStateEnumerationList
- .size(); i++) {
- validIds
- .add(relatedSPStateEnumerationList
- .get(i).getId());
-
- }
- //get the current value of the related service policy default operation
- String currentItemID = ""; //$NON-NLS-1$
- List<IPolicyOperation> relatedServicePolicyPolicyOperationsList = platformUI.getOperations(relatedPolicyEnumerationItem.getPolicy(), project ==null);
- IPolicyOperation relatedPolicyOperationItem = null;
- for (IPolicyOperation relatedServicePolicyPolicyOperationItem : relatedServicePolicyPolicyOperationsList) {
- if (relatedServicePolicyPolicyOperationItem.isUseDefaultData()) {
- currentItemID = relatedServicePolicyPolicyOperationItem.getStateItem(project);
- relatedPolicyOperationItem = relatedServicePolicyPolicyOperationItem;
- break;
- }
- }
-
- if (!validIds
- .contains(currentItemID)) {
- // policy state is invalid
- IStatus error = createUnsatisfiedRelationshipError(sp,
- operationLongName,
- operationSelectionLongName,
- dependantPolicyShortName,
- relatedPolicyOperationItem,
- relatedSPStateEnumerationList);
- allErrors.put(sp.getId(), error);
-
- }
-
-
- }
-
- }
-
- }
- }
-
- List<IServicePolicy> servicePolicyChildrenList = sp.getChildren();
- for (IServicePolicy servicePolicyChildrenItem : servicePolicyChildrenList) {
- validatePolicy(servicePolicyChildrenItem);
-
- }
-
- }
-
- /**
- * Sets the icon for the ti denoting it as valid
- * @param ti a valid tree item
- */
- private void setValidPolicyState(TreeItem ti) {
- IServicePolicy sp = (IServicePolicy) ti.getData();
- setImage(ti, sp, getIconOverlayInfo(sp, false));
- }
-
- /**
- * Sets the icon for ti denoting it as invalid, as well as ti's parent tree items
- * @param ti an invalid tree item
- * @param updateDetailsOnly true indicates do not update parent tree items only in master tree
- */
- private void setInvalidPolicyState(TreeItem ti, boolean updateDetailsOnly) {
- IServicePolicy SP = (IServicePolicy) ti.getData();
- setImage(ti, SP, getIconOverlayInfo(SP, true));
- TreeItem parent;
- if (ti.getParent() == masterPolicyTree || updateDetailsOnly)
- parent = ti.getParentItem();
- else
- parent = (ti.getParentItem() == null && SP.getParentPolicy() != null) ? getParentInMasterTree(SP
- .getId())
- : ti.getParentItem();
- while (parent != null) {
- setImage(parent, (IServicePolicy) parent.getData(),
- getIconOverlayInfo((IServicePolicy) parent.getData(),
- true));
- if (updateDetailsOnly)
- parent = parent.getParentItem();
- else {
- parent = (parent.getParentItem() == null && ((IServicePolicy) parent
- .getData()).getParentPolicy() != null) ? getParentInMasterTree(((IServicePolicy) parent
- .getData()).getParentPolicy().getId())
- : parent.getParentItem();
- }
-
- }
- }
-
- /**
- * Creates an error status object for the sp. The error message contains information about
- * an unsatisfied relationship
- * @param sp
- * @param operationLongName
- * @param operationSelectionLongName
- * @param dependantPolicyShortName
- * @param relatedOperation
- * @param relatedOperationAcceptableValues
- * @return an Error status
- */
- private IStatus createUnsatisfiedRelationshipError(IServicePolicy sp,
- String operationLongName, String operationSelectionLongName,
- String dependantPolicyShortName,
- IPolicyOperation relatedOperation,
- List<IStateEnumerationItem> relatedOperationAcceptableValues) {
- String dependantOperationShortName;
- String dependantOperationSelectionShortNameList;
- dependantOperationShortName = relatedOperation
- .getDescriptor().getShortName();
- dependantOperationSelectionShortNameList = new String();
- for (int i = 0; i < relatedOperationAcceptableValues.size(); i++) {
- IStateEnumerationItem item = relatedOperationAcceptableValues.get(i);
- if (i != 0)
- dependantOperationSelectionShortNameList += " | "; //$NON-NLS-1$
- dependantOperationSelectionShortNameList += item.getShortName();
-
- }
- String[] args = { sp.getDescriptor().getLongName(), operationLongName,
- operationSelectionLongName, dependantPolicyShortName,
- dependantOperationShortName,
- dependantOperationSelectionShortNameList};
- IStatus error = new Status(Status.ERROR,
- ServicePolicyActivatorUI.PLUGIN_ID, NLS.bind(
- WstSPUIPluginMessages.SERVICEPOLICIES_DEPENDENCY_ERROR,
- args));
- return error;
- }
-
- /**
- * @param parentID the id to find in the master tree
- * @return a TreeItem with the id in the master tree
- */
- private TreeItem getParentInMasterTree(String parentID) {
- TreeItem parent = null;
- TreeItem[] rootNodes = masterPolicyTree.getItems();
- for (int i = 0; i < rootNodes.length; i++) {
- parent = findChildNode(rootNodes[i], parentID);
- if (parent != null)
- break;
- }
- return parent;
-
- }
-
- /**
- * Returns a TreeItem associated with a child policy of ti
- * @param ti
- * @param id the policy id of a child node of ti
- * @return null if there is no child policy matching id
- */
- private TreeItem findChildNode(TreeItem ti, String id) {
- TreeItem toReturn = null;
- if (((IServicePolicy) ti.getData()).getId().equals(id)) {
- toReturn = ti;
- } else {
- TreeItem[] childItems = ti.getItems();
- for (int i = 0; i < childItems.length; i++) {
- toReturn = findChildNode(childItems[i], id);
- }
-
- }
- return toReturn;
-
- }
-
- /**
- * Returns dependancy information about sp, that is information about
- * it's relationships (if any) with other service policies
- * @param sp the service policy to get dependency info about
- * @return
- */
- private String getDependanciesText(IServicePolicy sp) {
- // the relationships defined for the policy
- List<IPolicyRelationship> relationShipList = sp.getRelationships();
- if (relationShipList == null || relationShipList.size() == 0)
- return WstSPUIPluginMessages.SERVICEPOLICIES_DEPENDENCIES_NONE;
- String toReturn = new String();
-
- String operationLongName;
- String operationSelectionLongName;
- String dependantPolicyShortName;
- String dependantOperationShortName;
- String dependantOperationSelectionShortNameList;
-
- for (IPolicyRelationship relationShipItem : relationShipList) {
- List<IPolicyOperation> policyOperationsList = platformUI
- .getOperations(relationShipItem.getPolicyEnumerationList()
- .getPolicy(), project == null);
- operationLongName = ""; //$NON-NLS-1$
- for (IPolicyOperation policyOperationItem : policyOperationsList) {
- if (policyOperationItem.isUseDefaultData()) {
- operationLongName = policyOperationItem.getDescriptor()
- .getLongName();
- break;
- }
- }
- // policies associated with the relationship item
- List<IPolicyEnumerationList> relatedPolicies = relationShipItem
- .getRelatedPolicies();
- List<IStateEnumerationItem> spStateEnumerationList = relationShipItem
- .getPolicyEnumerationList().getEnumerationList();
- for (IStateEnumerationItem stateEnumerationItem : spStateEnumerationList) {
- operationSelectionLongName = stateEnumerationItem.getLongName();
- for (IPolicyEnumerationList relatedPolicyEnumerationItem : relatedPolicies) {
- dependantPolicyShortName = relatedPolicyEnumerationItem
- .getPolicy().getDescriptor().getShortName();
- List<IStateEnumerationItem> relatedSPStateEnumerationList = relatedPolicyEnumerationItem
- .getEnumerationList();
- List<IPolicyOperation> relatedPolicyOperationsList = platformUI
- .getOperations(relatedPolicyEnumerationItem
- .getPolicy(), (project == null));
- dependantOperationShortName = ""; //$NON-NLS-1$
- for (IPolicyOperation relatedPolicyOperationItem : relatedPolicyOperationsList) {
- if (relatedPolicyOperationItem.isUseDefaultData())
- dependantOperationShortName = relatedPolicyOperationItem
- .getDescriptor().getShortName();
- break;
- }
-
- dependantOperationSelectionShortNameList = new String();
- for (int i = 0; i < relatedSPStateEnumerationList.size(); i++) {
- IStateEnumerationItem item = relatedSPStateEnumerationList
- .get(i);
- if (i != 0)
- dependantOperationSelectionShortNameList += " | "; //$NON-NLS-1$
- dependantOperationSelectionShortNameList += item
- .getShortName();
-
- }
- String[] args = { operationLongName,
- operationSelectionLongName,
- dependantPolicyShortName,
- dependantOperationShortName,
- dependantOperationSelectionShortNameList };
- toReturn += NLS.bind(
- WstSPUIPluginMessages.SERVICEPOLICIES_DEPENDENCIES,
- args)
- + "\r\n"; //$NON-NLS-1$
-
- }
-
- }
-
- }
- return toReturn;
- }
-
-
- /**
- * Saves to the preference store the widget data (widget data contains all
- * service policy operations the control applies to)
- * @param actionControl a widget who's data needs to be saved to the preference store
- *
- */
- private void updatePolicy(Control actionControl) {
-
- List<IPolicyOperation> policyOperationList = ((ActionControlData) actionControl.getData()).getPoList();
- IPolicyOperation po0 = policyOperationList.get(0);
-
- List<IServicePolicy> servicePolicyList = ((ActionControlData) actionControl
- .getData()).getSpList();
- if (actionControl instanceof Button
- && po0.getOperationKind().equals(OperationKind.complex))
- updateComplexOperationPreference(po0, servicePolicyList);
- else
- for (IPolicyOperation policyOperationItem : policyOperationList) {
-
- updateSelectionOperationPreference(actionControl, policyOperationItem);
- }
-
- }
-
- public boolean okToLeave() {
- return allErrors.size() == 0;
-
- }
-
- /**
- * Saves value of enumeration, selection, and iconselection type operations
- * to the preference store
- * @param actionControl the action control containing the value to set for the preference
- * @param po
- * @param sp
- */
- private void updateSelectionOperationPreference(Control actionControl, IPolicyOperation po) {
- String selectedValue;
-
- // We are updating the state of a service policy. We don't want this
- // update to trigger our state change listener.
- enableStateListener( false );
-
- if (actionControl instanceof Combo) {
- selectedValue = ((Combo) actionControl).getText();
- List<IStateEnumerationItem> enumItemList = ServicePolicyPlatform
- .getInstance().getStateEnumeration(po.getEnumerationId());
- for (IStateEnumerationItem enumItem : enumItemList) {
- if (enumItem.getLongName().equals(selectedValue)) {
- po.setStateItem(project, enumItem.getId());
- break;
- }
- }
-
- } else {
- if (((Button) actionControl).getSelection()) {
- po.setStateItem(project, "org.eclipse.wst.true"); //$NON-NLS-1$
- } else
- po.setStateItem(project, "org.eclipse.wst.false"); //$NON-NLS-1$
-
- }
-
- // Reenable our state change listener.
- enableStateListener( true );
- }
-
-
- private void addStateListener( IServicePolicy policy )
- {
- if( stateChangePolicySet.contains( policy ) ) return;
-
- if( project == null )
- {
- policy.getPolicyState().addPolicyStateChangeListener( stateChangeListener, false );
- }
- else
- {
- policy.getPolicyState( project ).addPolicyStateChangeListener( stateChangeListener, false );
- }
-
- stateChangePolicySet.add( policy );
- }
-
- private void removeStateListener( IServicePolicy policy )
- {
- if( stateChangePolicySet.contains( policy ) ) return;
-
- if( project == null )
- {
- policy.getPolicyState().removePolicyStateChangeListener( stateChangeListener );
- }
- else
- {
- policy.getPolicyState( project ).removePolicyStateChangeListener( stateChangeListener );
- }
-
- stateChangePolicySet.remove( policy );
- }
-
- private void enableStateListener( boolean enabled )
- {
- stateChangeEnabled = enabled;
- }
-
- /**
- * Launches the complex operation for the list of service policies
- * @param po a "complex" policy operation
- * @param sps a list of service policies to apply the operation to
- */
- private void updateComplexOperationPreference(IPolicyOperation po,
- List<IServicePolicy> sps) {
- //complex operations can result in added and deleted nodes, cache them until operation completed
- bComplexOpCompleted = false;
- listChildChangeEvents = new Vector<ChildChangeEvent>();
- try {
- po.launchOperation(sps);
- } catch (RuntimeException e) {
- //just want to make sure finally clause is executed so can update UI of additions/deletions
- } finally {
- bComplexOpCompleted =true;
- Hashtable<String, IServicePolicy> topLevelAdds = getHighestLevelChildren(listChildChangeEvents, true);
- for (ChildChangeEvent childChangeEventItem : listChildChangeEvents) {
- processChildChangeEvent(childChangeEventItem, topLevelAdds);
- }
-
- }
- }
- private Hashtable<String, IServicePolicy> getHighestLevelChildren (List<ChildChangeEvent> htChildChangeEvents, boolean forAddOnly) {
- Hashtable<String, IServicePolicy> toReturn = new Hashtable<String, IServicePolicy>();
- Iterator<ChildChangeEvent> elements = htChildChangeEvents.iterator();
- ChildChangeEvent next;
- Hashtable<String, IServicePolicy> allSps = new Hashtable<String, IServicePolicy>();
- while (elements.hasNext()) {
- next = elements.next();
- List<IServicePolicy> changedChildrenList = next.getChangedChildren();
- List<Boolean> addedList = next.getAdded();
- for (int i = 0; i < changedChildrenList.size(); i++) {
- if (forAddOnly && addedList.get(i).booleanValue() == true)
- allSps.put(changedChildrenList.get(i).getId(), changedChildrenList.get(i));
- }
- }
- Enumeration<IServicePolicy> servicePolicyElements = allSps.elements();
- IServicePolicy nextServicePolicyElement;
- while (servicePolicyElements.hasMoreElements()) {
- nextServicePolicyElement = servicePolicyElements.nextElement();
- if (nextServicePolicyElement.getParentPolicy() == null || !allSps.containsKey(nextServicePolicyElement.getParentPolicy().getId())) {
- toReturn.put(nextServicePolicyElement.getId(), nextServicePolicyElement);
- }
- }
- return toReturn;
- }
- public void dispose() {
- super.dispose();
- iconManager.dispose();
-
- for( IServicePolicy policy : stateChangePolicySet )
- {
- IPolicyState state = project == null ? policy.getPolicyState() : policy.getPolicyState( project );
-
- state.removePolicyStateChangeListener( stateChangeListener );
- }
- }
-
- /**
- * Create UI widgets for operations applicable to the list of service policies sp
- * @param spList the list of service policies to create UI widgets, the UI widgets
- * will be used to define operations/preferences to apply to the service policies in the list
- */
- private void addActionButtons(List<IServicePolicy> spList) {
-
- // remove existing action controls
- Control[] toRemove = operationsComposite.getChildren();
- for (int i = 0; i < toRemove.length; i++) {
- toRemove[i].dispose();
- }
- List<List<IPolicyOperation>> policyOperationListList = platformUI.getOperationsList(spList, (project == null));
-
- for (List<IPolicyOperation> policyOperationList : policyOperationListList) {
- if (policyOperationList.size() > 0) {
- if (policyOperationList.get(0).getOperationKind() == IPolicyOperation.OperationKind.complex) {
- addComplexOperationUI(policyOperationList, spList);
- } else
- addSelectionOperationUI(policyOperationList, spList);
- }
-
- }
- // just removed and added some controls so force composite
- // to re-layout it's controls
- operationsScrolledComposite.setMinSize(operationsComposite.computeSize(
- SWT.DEFAULT, SWT.DEFAULT));
- operationsComposite.layout();
- }
- /**
- * Creates UI widgets for policy operations of enumeration, selection, and
- * iconselection types
- * @param po the policy operation to create a UI widget for
- * @param sp the service policies this operation will apply to
- */
- private void addSelectionOperationUI(List<IPolicyOperation> pos, List<IServicePolicy> sps) {
- //use the first operation instance in the list for data
- IPolicyOperation po0 = pos.get(0);
- //IServicePolicy sp0 = pos.get(0).getServicePolicy();
- IDescriptor d = po0.getDescriptor();
- Control selectionControl;
- if (po0.getOperationKind() == IPolicyOperation.OperationKind.enumeration) {
- Label l = new Label(operationsComposite, SWT.NONE);
- l.setText(d.getLongName() + ":"); //$NON-NLS-1$
- GridData comboGD = new GridData(SWT.FILL, SWT.FILL, true, false);
-
- Combo cb = new Combo(operationsComposite, SWT.DROP_DOWN
- | SWT.READ_ONLY);
- cb.setLayoutData(comboGD);
- selectionControl = cb;
- cb.addSelectionListener(this);
- List<IStateEnumerationItem> enumItemList = ServicePolicyPlatform
- .getInstance().getStateEnumeration(po0.getEnumerationId());
- for (IStateEnumerationItem enumItem : enumItemList) {
- cb.add(enumItem.getLongName());
- }
- l.setEnabled(po0.isEnabled(sps));
- cb.setEnabled(po0.isEnabled(sps));
- if (cb.isEnabled())
- cb.setText(getEnumerationOperationCurrentSelection(po0));
- } else {
- // a selection or icon
- Button checkBox = new Button(operationsComposite, SWT.CHECK);
- selectionControl = checkBox;
- checkBox.addSelectionListener(this);
- GridData checkBoxGD = new GridData();
- checkBoxGD.horizontalSpan = 2;
- checkBox.setLayoutData(checkBoxGD);
- checkBox.setText(d.getLongName());
- checkBox.setEnabled(po0.isEnabled(sps));
- if (checkBox.isEnabled())
- checkBox
- .setSelection(getSelectionOperationCurrentSelection(po0));
-
- }
-
- selectionControl.setData(new ActionControlData(sps, pos));
-
- }
- /**
- * @param sp a service policy with a selection or iconselection operation defined
- * @return true if the operation is currently selected
- */
- private boolean getSelectionOperationCurrentSelection(IPolicyOperation po) {
- return po.getStateItem(project).equals("org.eclipse.wst.true") ? true : false; //$NON-NLS-1$
-
- }
-
- /**
- * @param sp a service policy with an enumeration operation defined
- * @return the currently selected enumeration item
- */
- private String getEnumerationOperationCurrentSelection(IPolicyOperation po) {
- String currentSelection = ""; //$NON-NLS-1$
- List<IStateEnumerationItem> enumItemList = ServicePolicyPlatform
- .getInstance().getStateEnumeration(po.getEnumerationId());
- for (IStateEnumerationItem enumItem : enumItemList) {
- if (enumItem.getId().equals(po.getStateItem(project))) {
- currentSelection = enumItem.getLongName();
- break;
- }
- }
- return currentSelection;
- }
-
- /**
- * Creates UI widgets for policy operations of complex type
- * @param po the policy operation to create a UI widget for
- * @param sps the service policies this operation will apply to
- */
- private void addComplexOperationUI(List<IPolicyOperation> pos,
- List<IServicePolicy> sps) {
- IPolicyOperation po0 = pos.get(0);
- IDescriptor d = po0.getDescriptor();
- Button pushButton = new Button(operationsComposite, SWT.PUSH);
- GridData pushButtonGD = new GridData();
- pushButtonGD.horizontalSpan = 2;
- pushButton.setLayoutData(pushButtonGD);
- pushButton.setText(d.getLongName());
- pushButton.addSelectionListener(this);
- pushButton.setData(new ActionControlData(sps, pos));
- pushButton.setEnabled(po0.isEnabled(sps));
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
-
- /**
- * @return the error that should be shown, if there are multiple validation errors,
- * return the validation error for a service policy that just changes state (often the
- * selected service policy)
- */
- public IStatus getError() {
- return error;
- }
-
- private class StateChangeListener implements IPolicyStateChangeListener
- {
- public void policyStateChange(IServicePolicy policy, String key, String oldValue, String newValue)
- {
- // We are not enabled for state change events so we will ignore this event.
- if( !stateChangeEnabled ) return;
-
- error = validateAllPolicies( policy );
-
- //inform listeners that a control has changed, as composite may be in error now
- listener.widgetSelected( null );
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyPlatformUIImpl.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyPlatformUIImpl.java
deleted file mode 100644
index 1ed1a9985..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyPlatformUIImpl.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding of service policy
- * 20080109 213497 pmoogk@ca.ibm.com - Peter Moogk
- * 20080325 222095 pmoogk@ca.ibm.com - Peter Moogk
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.listeners.IPolicyChildChangeListener;
-import org.eclipse.wst.ws.service.policy.ui.IPolicyOperation;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixActionInfo;
-
-public class ServicePolicyPlatformUIImpl
-{
- private Map<String, BaseOperationImpl> baseOperationMap;
- private Map<IServicePolicy, Set<IPolicyOperation>> policyCache;
- private Map<String,List<IQuickFixActionInfo>> quickFixes;
-
- public ServicePolicyPlatformUIImpl()
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- ServicePolicyRegistryUI registry = new ServicePolicyRegistryUI();
- Set<String> policyIds = platform.getAllPolicyIds();
-
- baseOperationMap = new HashMap<String, BaseOperationImpl>();
- policyCache = new HashMap<IServicePolicy, Set<IPolicyOperation>>();
- quickFixes = new HashMap<String, List<IQuickFixActionInfo>>();
- registry.load( baseOperationMap, quickFixes );
- createOperationCache( policyIds );
-
- platform.addChildChangeListener( new ChildListener(), false );
- }
-
- public List<IQuickFixActionInfo> getQuickFixes( IStatus status )
- {
- String pluginId = status.getPlugin();
- int code = status.getCode();
- String key = pluginId + ":" + code; //$NON-NLS-1$
- List<IQuickFixActionInfo> result = quickFixes.get( key );
-
- if( result == null )
- {
- result = new Vector<IQuickFixActionInfo>();
- quickFixes.put( key, result );
- }
-
- return result;
- }
-
- public List<IPolicyOperation> getAllOperations()
- {
- List<IPolicyOperation> operations = new Vector<IPolicyOperation>();
-
- for( Set<IPolicyOperation> operationSet : policyCache.values() )
- {
- operations.addAll( operationSet );
- }
-
- return operations;
- }
-
- public Set<IPolicyOperation> getOperationsForPolicy( IServicePolicy policy, boolean isWorkspace )
- {
- Set<IPolicyOperation> policyOperations = policyCache.get( policy );
- Set<IPolicyOperation> result = new HashSet<IPolicyOperation>();
-
- if( policyOperations != null )
- {
- result.addAll( policyOperations );
-
- if( !isWorkspace )
- {
- for( IPolicyOperation operation : policyOperations )
- {
- if( operation.isWorkspaceOnly() )
- {
- result.remove( operation );
- }
- }
- }
- }
-
- return result;
- }
-
- public List<List<IPolicyOperation>> getOperationsList( List<IServicePolicy> policies, boolean isWorkspace )
- {
- Map<String, List<IPolicyOperation>> operationMap = new HashMap<String, List<IPolicyOperation>>();
-
- for( IServicePolicy policy : policies )
- {
- Set<IPolicyOperation> operations = policyCache.get( policy );
-
- if( operations != null )
- {
- for( IPolicyOperation operation : operations )
- {
- String id = operation.getId();
- List<IPolicyOperation> entryList = operationMap.get( id );
-
- // We only want to add this operation if it is for the workspace preference page or
- // if we are on the project preference page and the operation is not only
- // for the workspace level.
- if( isWorkspace || !operation.isWorkspaceOnly() )
- {
- if( entryList == null )
- {
- entryList = new Vector<IPolicyOperation>();
- operationMap.put( id, entryList );
- }
-
- entryList.add( operation );
- }
- }
- }
- }
-
- return new Vector<List<IPolicyOperation>>( operationMap.values() );
- }
-
- private void createOperationCache( Set<String> policyIds )
- {
- ServicePolicyPlatform platform = ServicePolicyPlatform.getInstance();
- Collection<BaseOperationImpl> operations = baseOperationMap.values();
-
- for( BaseOperationImpl operation : operations )
- {
- String policyPattern = operation.getPolicyIdPattern();
- Pattern pattern = Pattern.compile( policyPattern );
-
- for( String policyId : policyIds )
- {
- Matcher matcher = pattern.matcher( policyId );
-
- if( matcher.matches() )
- {
- IServicePolicy policy = platform.getServicePolicy( policyId );
- Set<IPolicyOperation> operationsSet = policyCache.get(policy);
-
- if( operationsSet == null )
- {
- operationsSet = new HashSet<IPolicyOperation>();
- policyCache.put( policy, operationsSet );
- }
-
- operationsSet.add( new PolicyOperationImpl( operation, policy ) );
- }
- }
- }
- }
-
- private class ChildListener implements IPolicyChildChangeListener
- {
- public void childChange(List<IServicePolicy> childList, List<Boolean> addedList)
- {
- Set<String> idSet = new HashSet<String>();
-
- for( int index = 0; index < childList.size(); index++ )
- {
- IServicePolicy policy = childList.get( index );
- boolean added = addedList.get( index );
-
- if( added )
- {
-
- idSet.add( policy.getId() );
- }
- else
- {
- policyCache.remove( policy );
- }
- }
-
- if( idSet.size() > 0 )
- {
- createOperationCache( idSet );
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyRegistryUI.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyRegistryUI.java
deleted file mode 100644
index b4818a4b2..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/ServicePolicyRegistryUI.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk
- * 20080428 227501 pmoogk@ca.ibm.com - Peter Moogk, Fixed toLowerCase Locale problem.
- * 20080829 245754 pmoogk@ca.ibm.com - Peter Moogk, Added defaulting for selection operations.
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IPolicyStateEnum;
-import org.eclipse.wst.ws.service.policy.ui.IQuickFixActionInfo;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-import org.eclipse.wst.ws.service.policy.utils.RegistryUtils;
-
-public class ServicePolicyRegistryUI
-{
- private final String SERVICE_POLICY_ID = ServicePolicyActivatorUI.PLUGIN_ID + ".servicepolicyui"; //$NON-NLS-1$
-
- public void load( Map<String, BaseOperationImpl> operationMap, Map<String, List<IQuickFixActionInfo>> quickFixes )
- {
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SERVICE_POLICY_ID);
-
- for( IConfigurationElement element : elements )
- {
- String elementName = element.getName().toLowerCase( Locale.ENGLISH );
-
- if( elementName.equals( "servicepolicyui") ) //$NON-NLS-1$
- {
- IConfigurationElement[] children = element.getChildren();
-
- for( IConfigurationElement child : children )
- {
- String name = child.getName().toLowerCase( Locale.ENGLISH );
-
- if( name.equals( "operation" ) ) //$NON-NLS-1$
- {
- loadServicePolicyui( child, operationMap );
- }
- else if( name.equals( "quickfix") ) //$NON-NLS-1$
- {
- loadQuickFix( child, quickFixes );
- }
- else
- {
- error( "Undefined service policy ui element, " + name + " found." ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- else
- {
- error( "Undefined service policy ui element, " + elementName + " found." ); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- private void loadServicePolicyui( IConfigurationElement element,
- Map<String, BaseOperationImpl> operationMap )
- {
- String id = RegistryUtils.getAttribute( element, "id" ); //$NON-NLS-1$
- String policyPattern = RegistryUtils.getAttribute( element, "policypattern" ); //$NON-NLS-1$
- String workspaceOnly = RegistryUtils.getAttribute( element, "workspaceonly" ); //$NON-NLS-1$
- String useDefaultString = RegistryUtils.getAttribute( element, "defaultdata" ); //$NON-NLS-1$
- IConfigurationElement[] children = element.getChildren();
- IDescriptor descriptor = null;
- String enumId = null;
- String defaultItem = null;
- boolean selection = false;
- boolean icon = false;
- boolean multiSelect = false;
- IConfigurationElement enabledElement = null;
- IConfigurationElement launchElement = null;
- boolean error = false;
- boolean useDefaultData = true;
-
- if( useDefaultString != null )
- {
- useDefaultData = useDefaultString.equals( "true" ); //$NON-NLS-1$
- }
-
- for( IConfigurationElement child : children )
- {
- String name = child.getName().toLowerCase( Locale.ENGLISH );
-
- if( name.equals( "descriptor" ) ) //$NON-NLS-1$
- {
- descriptor = RegistryUtils.loadDescriptor( child );
- }
- else if( name.equals( "enumeration" ) ) //$NON-NLS-1$
- {
- enumId = RegistryUtils.getAttribute( child, "id" ); //$NON-NLS-1$
- defaultItem = RegistryUtils.getAttribute( child, "defaultitem" ); //$NON-NLS-1$
-
- if( enumId == null )
- {
- error( "Service policy ui enumeration element is missing id attribute." ); //$NON-NLS-1$
- error = true;
- }
- }
- else if( name.equals( "selection" ) ) //$NON-NLS-1$
- {
- String iconValue = RegistryUtils.getAttribute( child, "icon" ); //$NON-NLS-1$
-
- selection = true;
-
- if( iconValue != null && iconValue.equalsIgnoreCase( "true" ) ) //$NON-NLS-1$
- {
- icon = true;
- useDefaultData = true;
- }
-
- defaultItem = RegistryUtils.getAttribute( child, "defaultitem" ); //$NON-NLS-1$
-
- // If the defaultItem
- if( defaultItem != null &&
- !defaultItem.equals( IPolicyStateEnum.FALSE_ENUM) &&
- !defaultItem.equals( IPolicyStateEnum.TRUE_ENUM ) )
- {
- error( "The defaultItem attribute of a selection element must be: " + IPolicyStateEnum.TRUE_ENUM + " or " + IPolicyStateEnum.FALSE_ENUM + "." ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- error = true;
- }
- }
- else if( name.equals( "complex" ) ) //$NON-NLS-1$
- {
- String launchClass = RegistryUtils.getAttribute( child, "launchclass" ); //$NON-NLS-1$
-
- if( launchClass == null )
- {
- error( "Service policy ui enumeration element is missing id attribute." ); //$NON-NLS-1$
- error = true;
- }
-
- launchElement = child;
- }
- else if( name.equals( "enabled" ) ) //$NON-NLS-1$
- {
- String multiSelectValue = RegistryUtils.getAttribute( child, "multiselect" ).toLowerCase( Locale.ENGLISH ); //$NON-NLS-1$
-
- if( multiSelectValue != null && multiSelectValue.equals( "true" )) //$NON-NLS-1$
- {
- multiSelect = true;
- }
-
- String enabledClass = RegistryUtils.getAttribute( child, "enabledclass" ); //$NON-NLS-1$
-
- if( enabledClass != null )
- {
- enabledElement = child;
- }
- }
- else
- {
- error( "Undefined service policy ui element, " + name + " found." ); //$NON-NLS-1$ //$NON-NLS-2$
- error = true;
- }
- }
-
- if( descriptor == null )
- {
- error( "Service policy operation element must have a descriptor element defined." ); //$NON-NLS-1$
- error = true;
- }
-
- if( id == null )
- {
- error( "Id attribute not specified in service policy ui operation element." ); //$NON-NLS-1$
- error = true;
- }
-
- if( policyPattern == null )
- {
- error( "Id attribute not specified in service policy ui operation element." ); //$NON-NLS-1$
- error = true;
- }
-
- if( ( enumId == null && !selection && launchElement == null) ||
- ( enumId != null && (selection || launchElement != null)) ||
- ( selection && (enumId != null || launchElement != null)) ||
- ( launchElement != null && (selection && enumId != null)))
- {
- error( "Service policy operation element must have either an enumeration element or a selection element or a complex element" ); //$NON-NLS-1$
- error = true;
- }
-
- if( ! error )
- {
- BaseOperationImpl operation = new BaseOperationImpl();
- boolean workspaceOnlyValue = workspaceOnly != null && workspaceOnly.equals( "true" ); //$NON-NLS-1$
-
- operation.setId( id );
- operation.setPolicyIdPattern( policyPattern );
- operation.setDescriptor( descriptor );
- operation.setMultiSelect( multiSelect );
- operation.setEnumerationId( enumId );
- operation.setWorkspaceOnly( workspaceOnlyValue );
- operation.setUseDefaultData( useDefaultData );
-
- if( defaultItem != null )
- {
- operation.setDefaultItem( defaultItem );
- }
-
- if( selection )
- {
- operation.setEnumerationId( "org.eclipse.wst.service.policy.booleanEnum" ); //$NON-NLS-1$
- operation.setSelection( icon );
- }
-
- if( launchElement != null )
- {
- operation.setComplexElement( launchElement );
- }
-
- if( enabledElement != null )
- {
- operation.setEnabledElement( enabledElement );
- }
-
- operationMap.put( id, operation );
- }
- }
-
- private void loadQuickFix( IConfigurationElement element, Map<String, List<IQuickFixActionInfo>> quickFixes )
- {
- IConfigurationElement[] children = element.getChildren( "action" ); //$NON-NLS-1$
- String pluginId = RegistryUtils.getAttribute( element, "pluginid" ); //$NON-NLS-1$
- String code = RegistryUtils.getAttribute( element, "code" ); //$NON-NLS-1$
- List<IQuickFixActionInfo> fixList = new Vector<IQuickFixActionInfo>();
-
- for( IConfigurationElement child : children )
- {
- loadAction( child, fixList );
- }
-
- if( pluginId == null )
- {
- error( "Missing pluginId attribute for Service policy UI quick fix extension" ); //$NON-NLS-1$
- return;
- }
-
- if( code == null )
- {
- error( "Missing code attribute for Service policy UI quick fix extension" ); //$NON-NLS-1$
- return;
- }
-
- if( fixList.size() == 0 )
- {
- error( "Missing action element for Service policy UI quick fix extension" ); //$NON-NLS-1$
- return;
- }
-
- String key = pluginId + ":" + code; //$NON-NLS-1$
- quickFixes.put( key, fixList );
- }
-
- private void loadAction( IConfigurationElement element, List<IQuickFixActionInfo> fixList )
- {
- IConfigurationElement[] descElem = element.getChildren( "descriptor" ); //$NON-NLS-1$
- String clazz = RegistryUtils.getAttribute( element, "class" ); //$NON-NLS-1$
-
- if( descElem == null )
- {
- error( "Missing descriptor element for Service policy UI quick fix extension" ); //$NON-NLS-1$
- return;
- }
-
- if( clazz == null )
- {
- error( "Missing class attribute for Service policy UI quick fix extension" ); //$NON-NLS-1$
- return;
- }
-
- IDescriptor descriptor = RegistryUtils.loadDescriptor( element );
- QuickFixActionInfoImpl action = new QuickFixActionInfoImpl( element, descriptor );
-
- fixList.add( action );
- }
-
- private void error( String message )
- {
- ServicePolicyActivatorUI.logError( message, null );
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.java
deleted file mode 100644
index 1c45c0c20..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071025 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071107 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- * 20071212 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- * 20090306 224632 ericdp@ca.ibm.com - Eric D. Peters, Fix Service Policies preference page UI
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class WstSPUIPluginMessages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.wst.ws.internal.service.policy.ui.WstSPUIPluginMessages";//$NON-NLS-1$
-
- private WstSPUIPluginMessages() {
- // Do not instantiate
- }
-
- public static String LABEL_SERVICEPOLICIES_DESCRIPTION;
- public static String LABEL_SERVICEPOLICIES_DEPENDENCIES;
- public static String TOOLTIP_PSP_DESCRIPTION;
- public static String TOOLTIP_PSP_DEPENDENCIES;
- public static String TOOLTIP_PSP_TREE;
- public static String TOOLTIP_PSP_DETAILSTREE;
- public static String SERVICEPOLICIES_DEPENDENCIES;
- public static String SERVICEPOLICIES_DEPENDENCY_ERROR;
- public static String SERVICEPOLICIES_DEPENDENCIES_NONE;
- public static String LINK_CONFIGWORKSPACE_SETTINGS;
- public static String LABEL_ENABLE_PROJECT_SETTINGS;
- public static String LABEL_QFLINK;
- public static String TEXT_QFIX_NOSUG;
- public static String TEXT_DETAILS;
- public static String LABEL_SERVICEPOLICIES_PAGE_DESCRIPTION;
-
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, WstSPUIPluginMessages.class);
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.properties b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.properties
deleted file mode 100644
index 7ae00e4ea..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/WstSPUIPluginMessages.properties
+++ /dev/null
@@ -1,40 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2009 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
-# yyyymmdd bug Email and other contact information
-# -------- -------- -----------------------------------------------------------
-# 20071025 196997 ericdp@ca.ibm.com - Eric Peters
-# 20071107 196997 ericdp@ca.ibm.com - Eric Peters
-# 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
-# 20071212 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
-# 20090306 224632 ericdp@ca.ibm.com - Eric D. Peters, Fix Service Policies preference page UI
-###############################################################################
-
-#
-# Service Policies Preference page
-#
-
-LABEL_SERVICEPOLICIES_DESCRIPTION=Description:
-LABEL_SERVICEPOLICIES_DEPENDENCIES=Dependencies:
-#example message below is Compliance level "Suggest compliance" requires WS-I AP 1.0 [ suggest|ignore ]
-SERVICEPOLICIES_DEPENDENCIES={0} \"{1}\" requires {2} {3} [{4}]
-#example message below is WS-I SSBP Compliance level "Suggest compliance" requires WS-I AP 1.0 [ suggest|ignore ]
-SERVICEPOLICIES_DEPENDENCY_ERROR= {0} {1} \"{2}\" requires {3} {4} [{5}]
-SERVICEPOLICIES_DEPENDENCIES_NONE=None
-TOOLTIP_PSP_DESCRIPTION=Description of selected tree node
-TOOLTIP_PSP_DEPENDENCIES=Dependencies of selected tree node
-TOOLTIP_PSP_TREE=Select a tree node and use the panel on the right to define related preferences
-TOOLTIP_PSP_DETAILSTREE=Select a tree node and use the panel below to define related preferences
-LABEL_QFLINK=Quick Fix
-TEXT_QFIX_NOSUG=No Suggestions. See the error message and any listed dependencies for {1} to resolve the error.
-TEXT_DETAILS=details
-LINK_CONFIGWORKSPACE_SETTINGS=Configure Workspace Settings...
-LABEL_ENABLE_PROJECT_SETTINGS=Enable project specific settings
-LABEL_SERVICEPOLICIES_PAGE_DESCRIPTION=Specify quality of service related settings:
-
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/preferences/ServicePoliciesPreferencePage.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/preferences/ServicePoliciesPreferencePage.java
deleted file mode 100644
index f97064674..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/preferences/ServicePoliciesPreferencePage.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071025 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071107 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui.preferences;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.ws.internal.service.policy.ui.ServicePoliciesComposite;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-
-public class ServicePoliciesPreferencePage extends PreferencePage implements
- IWorkbenchPreferencePage, SelectionListener
-
-{
- ServicePoliciesComposite preferencePage;
- Composite superParent;
- public static final String PAGE_ID = "org.eclipse.wst.ws.internal.ui.wsi.preferences.WSICompliancePreferencePage"; //$NON-NLS-1$
-
- /**
- * Creates preference page controls on demand.
- *
- * @param parentComposite
- * the parent for the preference page
- */
- protected Control createContents(Composite superparent) {
- preferencePage = new ServicePoliciesComposite(superparent, null, this);
- org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent);
- this.superParent = superparent;
- return preferencePage;
-
- }
-
- /**
- * Does anything necessary because the default button has been pressed.
- */
- protected void performDefaults() {
- preferencePage.performDefaults();
- IStatus error = preferencePage.getError();
- if (error == null) {
- super.setValid(true);
- super.setErrorMessage(null);
- } else {
- super.setErrorMessage(error.getMessage());
- super.setValid(false);
- }
- }
-
- /**
- * Do anything necessary because the OK button has been pressed.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- storeValues();
- return true;
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues() {
- ServicePolicyPlatform.getInstance().commitChanges();
- }
-
- /**
- * Do anything necessary because the Cancel button has been pressed.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performCancel() {
- ServicePolicyPlatform.getInstance().discardChanges();
- return true;
- }
-
- /**
- * Do anything necessary because the OK button has been pressed.
- *
- */
- protected void performApply() {
- storeValues();
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * @return whether it is okay to close the preference page
- */
- public boolean okToLeave() {
- return preferencePage.getError() == null;
-
- }
-
- public void dispose() {
- super.dispose();
- preferencePage.dispose();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
-
- public void widgetSelected(SelectionEvent e) {
- IStatus error = preferencePage.getError();
- if (error == null) {
- super.setValid(true);
- super.setErrorMessage(null);
- } else {
- super.setErrorMessage(error.getMessage());
- super.setValid(false);
- }
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePoliciesPropertyPage.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePoliciesPropertyPage.java
deleted file mode 100644
index fca0af53b..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePoliciesPropertyPage.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071107 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071108 196997 ericdp@ca.ibm.com - Eric Peters
- * 20071120 209858 ericdp@ca.ibm.com - Eric Peters, Enhancing service policy framework and UI
- *******************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui.properties;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ControlEnableState;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.ws.internal.service.policy.ui.ServicePoliciesComposite;
-import org.eclipse.wst.ws.internal.service.policy.ui.WstSPUIPluginMessages;
-import org.eclipse.wst.ws.internal.service.policy.ui.preferences.ServicePoliciesPreferencePage;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-import org.eclipse.wst.ws.service.policy.ui.ServicePolicyActivatorUI;
-
-public class ServicePoliciesPropertyPage extends PropertyPage implements
- SelectionListener {
-
- private ServicePoliciesComposite propertyPage;
- private IProject project;
- public static final String PAGE_ID = "org.eclipse.wst.ws.internal.ui.wsi.properties.WSICompliancePropertyPage"; //$NON-NLS-1$
- private Button fUseProjectSettings;
- private Link fChangeWorkspaceSettings;
- private ControlEnableState fBlockEnableState;
- private Control fConfigurationBlockControl;
- private ServicePolicyPlatform platform = ServicePolicyPlatform
- .getInstance();
-
- public ServicePoliciesPropertyPage() {
- fBlockEnableState = null;
- }
-
- protected Control createContents(Composite superparent) {
- project = (IProject) getElement().getAdapter(IProject.class);
- boolean projectPrefsEnabled = platform
- .isProjectPreferencesEnabled(project);
- if (!projectPrefsEnabled) {
- //enable them so that service policies composite UI reflects
- //currently set project preferences, otherwise shows workspace
- //preferences and would need to redraw tree when user enables them
- platform.setProjectPreferencesEnabled(project, true);
- }
- propertyPage = new ServicePoliciesComposite(superparent, project, this);
- platform.setProjectPreferencesEnabled(project, projectPrefsEnabled);
- fConfigurationBlockControl = propertyPage;
- enablePreferenceContent(projectPrefsEnabled);
- fUseProjectSettings.setSelection(projectPrefsEnabled);
- updateLinkVisibility();
-
- org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent);
- return propertyPage;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- propertyPage.widgetDefaultSelected(e);
- }
-
- public void dispose() {
- super.dispose();
- propertyPage.dispose();
- }
-
- public boolean okToLeave() {
- return propertyPage.getError() == null;
-
- }
-
- protected void performApply() {
- if (!fUseProjectSettings.getSelection()) {
- platform.setProjectPreferencesEnabled(project, false);
- }
- storeValues();
- }
-
- /**
- * Do anything necessary because the Cancel button has been pressed.
- * @return whether it is okay to close the preference page
- */
- public boolean performCancel() {
- platform.discardChanges(project);
- return true;
- }
-
- /**
- * Does anything necessary because the default button has been pressed.
- */
- protected void performDefaults() {
- enableProjectSpecificSettings(false);
- platform.setProjectPreferencesEnabled(project, false);
- propertyPage.performDefaults();
- IStatus error = propertyPage.getError();
- if (error == null) {
- super.setValid(true);
- super.setErrorMessage(null);
- } else {
- super.setErrorMessage(error.getMessage());
- super.setValid(false);
- }
-
- }
-
- /**
- * Do anything necessary because the OK button has been pressed.
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- if (!fUseProjectSettings.getSelection()) {
- platform.setProjectPreferencesEnabled(project, false);
- }
- storeValues();
- return true;
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues() {
- platform.commitChanges(project);
- }
-
- public void widgetSelected(SelectionEvent e) {
- IStatus error = propertyPage.getError();
- if (error == null) {
- super.setValid(true);
- super.setErrorMessage(null);
- } else {
- super.setErrorMessage(error.getMessage());
- super.setValid(false);
- }
-
- }
-
- protected Label createDescriptionLabel(Composite parent) {
- // fParentComposite= parent;
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite
- .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-
- SelectionListener listener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent se) {
- }
-
- public void widgetSelected(SelectionEvent se) {
- enableProjectSpecificSettings(fUseProjectSettings
- .getSelection());
- platform.setProjectPreferencesEnabled(project,
- fUseProjectSettings.getSelection());
- }
- };
-
- fUseProjectSettings = new Button(composite, SWT.CHECK);
- fUseProjectSettings.addSelectionListener(listener);
- fUseProjectSettings
- .setText(WstSPUIPluginMessages.LABEL_ENABLE_PROJECT_SETTINGS);
- GridData gd = new GridData();
- gd.horizontalSpan = 1;
- gd.horizontalAlignment = GridData.FILL;
- fUseProjectSettings.setLayoutData(gd);
- fChangeWorkspaceSettings = createLink(composite,
- WstSPUIPluginMessages.LINK_CONFIGWORKSPACE_SETTINGS);
- fChangeWorkspaceSettings.setLayoutData(new GridData(SWT.END,
- SWT.CENTER, false, false));
-
- Label horizontalLine = new Label(composite, SWT.SEPARATOR
- | SWT.HORIZONTAL);
- horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
- true, false, 2, 1));
- horizontalLine.setFont(composite.getFont());
-
- return super.createDescriptionLabel(parent);
- }
-
- private Link createLink(Composite composite, String text) {
- Link link = new Link(composite, SWT.NONE);
- link.setFont(composite.getFont());
- link.setText("<A>" + text + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
- link.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- openWorkspacePreferences((Link) e.widget);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- openWorkspacePreferences((Link) e.widget);
- }
- });
- return link;
- }
-
- private void updateLinkVisibility() {
- if (fChangeWorkspaceSettings == null
- || fChangeWorkspaceSettings.isDisposed()) {
- return;
- }
-
- fChangeWorkspaceSettings.setEnabled(!useProjectSettings());
- }
-
- protected boolean useProjectSettings() {
- return fUseProjectSettings.getSelection();
- }
-
- protected void enablePreferenceContent(boolean enable) {
- if (enable) {
- if (fBlockEnableState != null) {
- fBlockEnableState.restore();
- fBlockEnableState = null;
- }
- } else {
- if (fBlockEnableState == null) {
- fBlockEnableState = ControlEnableState
- .disable(fConfigurationBlockControl);
- }
- }
- }
-
- protected void enableProjectSpecificSettings(
- boolean useProjectSpecificSettings) {
- fUseProjectSettings.setSelection(useProjectSpecificSettings);
- enablePreferenceContent(useProjectSpecificSettings);
- updateLinkVisibility();
- doStatusChanged();
- }
-
- protected void doStatusChanged() {
- if (useProjectSettings()) {
- IStatus status;
- status = (propertyPage.getError() == null) ? new Status(IStatus.OK,
- ServicePolicyActivatorUI.PLUGIN_ID, "") : propertyPage //$NON-NLS-1$
- .getError();
- updateStatus(status);
- } else {
- updateStatus(new Status(IStatus.OK,
- ServicePolicyActivatorUI.PLUGIN_ID, "")); //$NON-NLS-1$
- }
- }
-
- private void updateStatus(IStatus status) {
- boolean valid = (status == null || !status.matches(IStatus.ERROR));
- setValid(valid);
- applyToStatusLine(this, status);
- }
-
- /**
- * Applies the status to the status line of a dialog page.
- * @param page the dialog page
- * @param status the status to apply
- */
- public static void applyToStatusLine(DialogPage page, IStatus status) {
- String message = status.getMessage();
- if (message != null && message.length() == 0) {
- message = null;
- }
- switch (status.getSeverity()) {
- case IStatus.OK:
- page.setMessage(message, IMessageProvider.NONE);
- page.setErrorMessage(null);
- break;
- case IStatus.WARNING:
- page.setMessage(message, IMessageProvider.WARNING);
- page.setErrorMessage(null);
- break;
- case IStatus.INFO:
- page.setMessage(message, IMessageProvider.INFORMATION);
- page.setErrorMessage(null);
- break;
- default:
- page.setMessage(null);
- page.setErrorMessage(message);
- break;
- }
- }
-
- protected final void openWorkspacePreferences(Object data) {
- String id = ServicePoliciesPreferencePage.PAGE_ID;
- PreferencesUtil.createPreferenceDialogOn(getShell(), id,
- new String[] { id }, data).open();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePolicyPropertyTester.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePolicyPropertyTester.java
deleted file mode 100644
index 94505bc36..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/internal/service/policy/ui/properties/ServicePolicyPropertyTester.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.wst.ws.internal.service.policy.ui.properties;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.wst.ws.service.policy.ServicePolicyPlatform;
-
-public class ServicePolicyPropertyTester extends PropertyTester
-{
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue)
- {
- return ServicePolicyPlatform.getInstance().isEnabled( receiver );
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IEnableOperation.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IEnableOperation.java
deleted file mode 100644
index 1773189d1..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IEnableOperation.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import java.util.List;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This interface is associated with the enabledClass attribute of the
- * enabled element.
- *
- */
-public interface IEnableOperation
-{
- /**
- * Returns whether the service policy operation should be enabled or not.
- *
- * @param selectedPolicies the selected service policies.
- * @return returns whether the service policy operation should be enabled or not.
- */
- public boolean isEnabled( List<IServicePolicy> selectedPolicies );
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ILaunchOperation.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ILaunchOperation.java
deleted file mode 100644
index 816c3f0a4..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ILaunchOperation.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import java.util.List;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This interface is used in conjunction with the launchClass attribute of
- * the complex element.
- *
- */
-public interface ILaunchOperation
-{
- /**
- * This method is called when the user has selected this complex operation.
- *
- * @param selectedPolicies a list of the service policies that were selected.
- */
- public void launch( List<IServicePolicy> selectedPolicies );
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IPolicyOperation.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IPolicyOperation.java
deleted file mode 100644
index 4cf5f7e3e..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IPolicyOperation.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This interface represents a Service policy operation that has been defined
- * in the plugin.xml meta data.
- *
- */
-public interface IPolicyOperation
-{
- /**
- *
- * Indicates the kind of Service policy operation that this object represents.
- * <ul>
- * <li>enumeration: indicates that a list of enumerated values is associated.</li>
- * <li>selection: indicates that this operation is associated with some
- * boolean operation</li>
- * <li> iconSelection: this operation is similar to the selection operation
- * except that it visual state is rendered via an icon.</li>
- * <li>complex: indicates that some complex operation is required to render
- * and persist some policy data. This operation will be rendered via a UI
- * button. When this button is selected the launch class associated with this
- * operation is called.</li>
- * <ul/>
- */
- public enum OperationKind { enumeration, selection, iconSelection, complex };
-
- /**
- *
- * Returns the unique ID associated with this service policy operation.
- *
- * @return returns the unique ID associated with this service policy operation.
- */
- public String getId();
-
- /**
- *
- * Returns the descriptor for this service policy operation.
- *
- * @return returns the descriptor for this service policy operation.
- */
- public IDescriptor getDescriptor();
-
- /**
- *
- * Returns whether this is a workspace only operation or not.
- *
- * @return returns true if this service policy operation should only appear
- * in the workspace service policy preference page.
- */
- public boolean isWorkspaceOnly();
-
- /**
- *
- * Returns the kind of service policy operation.
- *
- * @return returns the kind of service policy operation.
- */
- public OperationKind getOperationKind();
-
- /**
- *
- * Returns the enum ID for this operation.
- *
- * @return returns the enumeration ID if this service policy operation is
- * an enumeration.
- */
- public String getEnumerationId();
-
- /**
- *
- * Returns the default enumeration item for this operation.
- *
- * @return returns if this is an enumeration it returns the default item for this
- * enumeration.
- */
- public String getDefaultItem();
-
- /**
- * Launches the service policy operation if this is a complex operation.
- *
- * @param selectedPolicies the selected service policies.
- */
- public void launchOperation( List<IServicePolicy> selectedPolicies );
-
- /**
- *
- * Returns whether this operation should be enabled or not.
- *
- * @param selectedPolicies the selected service policies.
- *
- * @return returns whether this operation should be enabled or not.
- */
- public boolean isEnabled( List<IServicePolicy> selectedPolicies );
-
- /**
- *
- * Returns the id pattern for this operation.
- *
- * @return returns the regular expression pattern associated with this operation.
- * All service policy ID that match this regular expression will be associated
- * with this operation.
- */
- public String getPolicyIdPattern();
-
- /**
- *
- * Returns the service policy for this operation.
- *
- * @return returns the service policy for this operation.
- */
- public IServicePolicy getServicePolicy();
-
- /**
- *
- * Returns the current enumeration item for this operation.
- *
- * @param project the project if this is project property page item.
- * For the preference page context null should be specified.
- * @return returns the current enumeration item for this operation.
- */
- public String getStateItem( IProject project );
-
- /**
- * Sets the current enumeration item for this operation.
- *
- * @param project the project if this is project property page item.
- * For the preference page context null should be specified.
- * @param stateItem the item.
- */
- public void setStateItem( IProject project, String stateItem );
-
- /**
- *
- * Returns whether this operation uses default state or not.
- *
- * @return returns whether this operation uses default state or not.
- */
- public boolean isUseDefaultData();
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixAction.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixAction.java
deleted file mode 100644
index daff74e1f..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This interface is used by extenders to add quick fixes to the service policy ui
- * framework.
- *
- */
-public interface IQuickFixAction
-{
- /**
- * This method is called when the user has selected this action to resolve
- * a particular service policy problem.
- *
- * @param policy The policy that this quick fix applies to.
- */
- public void action( IServicePolicy policy);
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixActionInfo.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixActionInfo.java
deleted file mode 100644
index ca7df3569..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/IQuickFixActionInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071120 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import org.eclipse.wst.ws.service.policy.IDescriptor;
-
-/**
- *
- * This interface is used to store quick fix action information.
- *
- */
-public interface IQuickFixActionInfo
-{
- /**
- * Returns a descriptor for this quick fix.
- *
- * @return returns a descriptor for this quick fix.
- */
- public IDescriptor getDescriptor();
-
- /**
- * Returns the action for this quick fix.
- *
- * @return returns the action for this quick fix.
- */
- public IQuickFixAction getAction();
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyActivatorUI.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyActivatorUI.java
deleted file mode 100644
index 5f632a7e1..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyActivatorUI.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IStartup;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class ServicePolicyActivatorUI extends Plugin implements IStartup {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.wst.ws.service.policy.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static ServicePolicyActivatorUI plugin;
-
- /**
- * The constructor
- */
- public ServicePolicyActivatorUI() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns an image descriptor for the named resource
- * as relative to the plugin install location.
- * @return An image descriptor, possibly null.
- */
- public static ImageDescriptor getImageDescriptor(String name) {
- try {
- URL installURL = plugin.getBundle().getEntry("/"); //$NON-NLS-1$
- URL imageURL = new URL(installURL, name);
- return ImageDescriptor.createFromURL(imageURL);
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ServicePolicyActivatorUI getDefault() {
- return plugin;
- }
-
- /**
- * Logs error message for this plugin.
- *
- * @param message
- * @param exc
- */
- public static void logError( String message, Throwable exc )
- {
- IStatus status = new Status( IStatus.ERROR, PLUGIN_ID, 0, message, exc );
-
- getDefault().getLog().log(status);
- }
-
- /**
- * Called by Eclipse when it starts up.
- */
- public void earlyStartup()
- {
- // DO nothing. All we want to do is get the plugin loaded at UI start time.
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyPlatformUI.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyPlatformUI.java
deleted file mode 100644
index fab56f202..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/ServicePolicyPlatformUI.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071024 196997 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.ws.internal.service.policy.ui.ServicePolicyPlatformUIImpl;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This class is used to get Service policy UI information.
- *
- */
-public class ServicePolicyPlatformUI
-{
- private static ServicePolicyPlatformUI instance;
-
- private ServicePolicyPlatformUIImpl platformUI;
-
- private ServicePolicyPlatformUI()
- {
- platformUI = new ServicePolicyPlatformUIImpl();
- }
-
- /**
- *
- * Returns an instance of this service policy platform UI object.
- *
- * @return returns an instance of this service policy platform UI object.
- */
- public static ServicePolicyPlatformUI getInstance()
- {
- if( instance == null )
- {
- instance = new ServicePolicyPlatformUI();
- }
-
- return instance;
- }
-
- /**
- *
- * Returns all the operations for all known policies.
- *
- * @return returns all the operations for all known policies.
- */
- public List<IPolicyOperation> getAllOperations()
- {
- return platformUI.getAllOperations();
- }
-
- /**
- * Returns an operation that is associated with a particular service policy
- * and has the specified id.
- *
- * @param policy the service policy
- * @param id the operation id.
- * @return returns the operation being searched for or null is not found.
- */
- public IPolicyOperation getOperation( IServicePolicy policy, String id )
- {
- List<IPolicyOperation> operations = getOperations( policy, true );
- IPolicyOperation result = null;
-
- for( IPolicyOperation operation : operations )
- {
- if( operation.getId().equals( id ) )
- {
- result = operation;
- break;
- }
- }
-
- return result;
- }
-
- /**
- *
- * Returns the list of operations for this policy.
- *
- * @param policy the policy
- * @param isWorkspace true if this is a preference page context
- * @return returns the list of operations for this policy.
- */
- public List<IPolicyOperation> getOperations( IServicePolicy policy, boolean isWorkspace )
- {
- return new Vector<IPolicyOperation>( platformUI.getOperationsForPolicy( policy, isWorkspace ) );
- }
-
- /**
- *
- * Returns a list of list policy operations which are associated with
- * the specified service policies.
- *
- * @param policies
- * @param isWorkspace
- * @return returns a list that contains a list of operations. Each list
- * as the top level contains list of IPolicyOperations that reference the
- * same base operation. However, they will each have different associated
- * policies.
- */
- public List<List<IPolicyOperation>> getOperationsList( List<IServicePolicy> policies, boolean isWorkspace )
- {
- return platformUI.getOperationsList( policies, isWorkspace );
- }
-
- /**
- *
- * Returns a list of quick fix info for the specified status object.
- *
- * @param status
- * @return returns a list of quick fixes for this status object. If
- * no quick fixes are available an empty list will be returned.
- */
- public List<IQuickFixActionInfo> getQuickFixes( IStatus status )
- {
- return platformUI.getQuickFixes( status );
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ActivityUtils.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ActivityUtils.java
deleted file mode 100644
index fb6352366..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ActivityUtils.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20071122 209858 pmoogk@ca.ibm.com - Peter Moogk, Initial coding.
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui.utils;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.activities.IActivityManager;
-import org.eclipse.ui.activities.IIdentifier;
-import org.eclipse.wst.ws.service.policy.IFilter;
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * Used by the Eclipse activities framework.
- *
- */
-public class ActivityUtils
-{
- /**
- * Returns a service policy filter based on the Eclipse activities settings.
- *
- * @return returns a service policy filter based on the Eclipse activities settings.
- */
- public static IFilter getCurrentActivitiesFilter()
- {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- final IActivityManager manager = workbench.getActivitySupport().getActivityManager();
-
- return new IFilter()
- {
- public boolean accept( IServicePolicy policy )
- {
- IIdentifier identifier = manager.getIdentifier( policy.getId() );
-
- return identifier == null ? false : identifier.isEnabled();
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ServiceUtils.java b/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ServiceUtils.java
deleted file mode 100644
index afbc49f7e..000000000
--- a/bundles/org.eclipse.wst.ws.service.policy.ui/src/org/eclipse/wst/ws/service/policy/ui/utils/ServiceUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- * yyyymmdd bug Email and other contact information
- * -------- -------- -----------------------------------------------------------
- * 20080211 218520 pmoogk@ca.ibm.com - Peter Moogk
- * 20080516 232603 pmoogk@ca.ibm.com - Peter Moogk, Clean up java doc
- *******************************************************************************/
-package org.eclipse.wst.ws.service.policy.ui.utils;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.TreeSet;
-import java.util.Vector;
-
-import org.eclipse.wst.ws.service.policy.IServicePolicy;
-
-/**
- *
- * This class contains utility method for service policies.
- *
- */
-public class ServiceUtils
-{
- /**
- * Sorts a list of service policies.
- *
- * @param unsortedList an unsorted list
- * @return returns a list of sorted service policies base not their long names.
- */
- public static List<IServicePolicy> sortList( List<IServicePolicy> unsortedList )
- {
- TreeSet<IServicePolicy> sortedSet = new TreeSet<IServicePolicy>( new CompareServicePolicy() );
- Vector<IServicePolicy> sortedList = new Vector<IServicePolicy>();
-
- sortedSet.addAll( unsortedList );
- sortedList.addAll( sortedSet );
-
- return sortedList;
- }
-
- private static class CompareServicePolicy implements Comparator<IServicePolicy>
- {
- public int compare(IServicePolicy arg0, IServicePolicy arg1)
- {
- String name0 = arg0.getDescriptor().getLongName();
- String name1 = arg1.getDescriptor().getLongName();
-
- return name0.compareTo( name1 );
- }
- }
-}

Back to the top