JBoss Tools SVN: r25801 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools: internal and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-13 12:53:57 -0400 (Wed, 13 Oct 2010)
New Revision: 25801
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/DataBindingUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/CompositeValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
[JBIDE-7329] reverted internal package move
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/DataBindingUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/DataBindingUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/DataBindingUtils.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.internal.deltacloud.ui.common.databinding;
+
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.Binding;
+
+public class DataBindingUtils
+{
+ private DataBindingUtils()
+ {
+ }
+
+ /**
+ * Disposes all bindings in a given collection an clears the collection.
+ *
+ * @param bindingCollection the binding collection
+ *
+ * @return the collection<binding>
+ */
+ public static Collection<Binding> disposeBindings( Collection<Binding> bindingCollection )
+ {
+ if ( bindingCollection != null )
+ {
+ for ( Binding binding : bindingCollection )
+ {
+ binding.dispose();
+ }
+ bindingCollection.clear();
+ }
+ return bindingCollection;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/DataBindingUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,40 @@
+package org.jboss.tools.internal.deltacloud.ui.common.databinding;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.ValidationStatusProvider;
+import org.eclipse.core.databinding.observable.value.ComputedValue;
+import org.eclipse.core.runtime.IStatus;
+
+public class MaxSeverityValidationStatusProvider extends ComputedValue {
+
+ private Collection validationStatusProviders;
+
+ public MaxSeverityValidationStatusProvider(DataBindingContext dbc) {
+ super(ValidationStatusProvider.class);
+ this.validationStatusProviders = dbc.getValidationStatusProviders();
+ }
+
+ protected Object calculate() {
+ int maxSeverity = IStatus.OK;
+ ValidationStatusProvider maxSeverityProvider = null;
+ for (Iterator it = validationStatusProviders.iterator(); it.hasNext();) {
+ ValidationStatusProvider provider = (ValidationStatusProvider) it
+ .next();
+ IStatus status = (IStatus) provider.getValidationStatus()
+ .getValue();
+ if (status.getSeverity() > maxSeverity) {
+ maxSeverity = status.getSeverity();
+ maxSeverityProvider = provider;
+ }
+ }
+ return maxSeverityProvider;
+ }
+
+ public synchronized void dispose() {
+ validationStatusProviders = null;
+ super.dispose();
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.common.databinding;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * A POJO base class that may notify observers on behalf of
+ * {@link PropertyChangeSupport}
+ */
+public abstract class ObservablePojo {
+
+ private PropertyChangeSupport propertyChangeSupport;
+
+ public ObservablePojo() {
+ this.propertyChangeSupport = new PropertyChangeSupport(this);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ protected PropertyChangeSupport getPropertyChangeSupport() {
+ return propertyChangeSupport;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/ObservablePojo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/CompositeValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/CompositeValidator.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/CompositeValidator.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.common.databinding.validator;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class CompositeValidator implements IValidator {
+
+ private final LogicOp operator;
+
+ private final IValidator[] validatorCollection;
+
+ public static enum LogicOp {
+ AND,
+ OR
+ };
+
+ public CompositeValidator(final IValidator... validators) {
+ this(LogicOp.AND, validators);
+ }
+
+ public CompositeValidator(final LogicOp operator, final IValidator... validators) {
+ Assert.isLegal(operator != null);
+ Assert.isLegal(validators != null);
+
+ this.operator = operator;
+ validatorCollection = validators;
+ }
+
+ public IStatus validate(final Object value) {
+ return LogicOp.AND.equals(operator) ? andValidate(value) : orValidate(value);
+ }
+
+ /**
+ * validates on behalf of all validators. The validation stops, as soon as
+ * there's one validator that does <tt>NOT</tt> return Status#OK_Status
+ *
+ * @param value
+ * the value
+ *
+ * @return the status of this validation process
+ */
+ private IStatus andValidate(final Object value) {
+ IStatus result = Status.OK_STATUS;
+ ;
+ for (int i = 0; i < validatorCollection.length && result.isOK(); i++) {
+ result = validatorCollection[i].validate(value);
+ }
+ return result;
+ }
+
+ /**
+ * validates on behalf of all validators. The validation stops, as soons as
+ * there's one validator that does return Status#OK_Status
+ *
+ * @param value
+ * the value
+ *
+ * @return the status of this validation process
+ */
+ private IStatus orValidate(final Object value) {
+ IStatus result = Status.OK_STATUS;
+ ;
+ for (int i = 0; i < validatorCollection.length && result.isOK(); i++) {
+ result = validatorCollection[i].validate(value);
+ }
+ return result;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/CompositeValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.common.databinding.validator;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A {@link IValidator} that validates ok if the string it shall validate is not empty.
+ */
+public class MandatoryStringValidator implements IValidator {
+
+ private String errorMessage;
+
+ public MandatoryStringValidator(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ *
+ * validates the given string. Validation passes only if the given value is
+ * not <tt>null</tt> and it's length's larger than 0
+ *
+ */
+ public IStatus validate(Object value) {
+ if (!((value instanceof String) && ((String) value).length() > 0)) {
+ return ValidationStatus.error(errorMessage);
+ }
+ return ValidationStatus.ok();
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.common.swt;
+
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+
+public class JFaceUtils {
+
+ public static ControlDecoration createDecoration(Control control, String message) {
+ ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
+ controlDecoration.setDescriptionText(message);
+ FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ controlDecoration.setImage(fieldDecoration.getImage());
+ return controlDecoration;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/common/swt/JFaceUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.menus.IMenuService;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UIUtils
+{
+
+ private UIUtils()
+ {
+ }
+
+ /**
+ * Returns the selection of the active workbench window.
+ *
+ * @return the selection
+ *
+ * @see IWorkbenchWindow#getSelectionService()
+ */
+ public static ISelection getWorkbenchWindowSelection()
+ {
+ return getActiveWorkbenchWindow().getSelectionService().getSelection();
+ }
+
+ /**
+ * Gets the structured selection.
+ *
+ * @return the structured selection
+ */
+ public static IStructuredSelection getStructuredSelection()
+ {
+ ISelection selection = getWorkbenchWindowSelection();
+ if ( selection instanceof IStructuredSelection )
+ {
+ return ( IStructuredSelection ) selection;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the first element.
+ *
+ * @param selection the selection
+ * @param expectedClass the expected class
+ *
+ * @return the first element
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getFirstElement( final ISelection selection, final Class<T> expectedClass )
+ {
+ if ( selection == null )
+ {
+ return null;
+ }
+ else
+ {
+ Assert.isTrue( selection instanceof IStructuredSelection );
+ Object firstElement = ( ( IStructuredSelection ) selection ).getFirstElement();
+ if ( expectedClass.isAssignableFrom( firstElement.getClass() ) )
+ {
+ return ( T ) firstElement;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Gets the active page.
+ *
+ * @return the active page
+ */
+ public static IWorkbenchPage getActivePage()
+ {
+ IWorkbenchPage workbenchPage = getActiveWorkbenchWindow().getActivePage();
+ Assert.isNotNull( workbenchPage );
+ return workbenchPage;
+ }
+
+ /**
+ * Returns the editor that's currently active (focused).
+ *
+ * @return the active editor
+ */
+ public static IEditorPart getActiveEditor()
+ {
+ IEditorPart editor = getActivePage().getActiveEditor();
+ Assert.isNotNull( editor );
+ return editor;
+ }
+
+ /**
+ * Gets the active workbench window.
+ *
+ * @return the active workbench window
+ */
+ public static IWorkbenchWindow getActiveWorkbenchWindow()
+ {
+ IWorkbenchWindow workbenchWindow = getWorkbench().getActiveWorkbenchWindow();
+ Assert.isNotNull( workbenchWindow );
+ return workbenchWindow;
+ }
+
+ /**
+ * Gets the workbench.
+ *
+ * @return the workbench
+ */
+ public static IWorkbench getWorkbench()
+ {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ Assert.isNotNull( workbench );
+ return workbench;
+ }
+
+ /**
+ * Replaces an image with the given key by the given image descriptor.
+ *
+ * @param imageKey the image key
+ * @param imageDescriptor the image descriptor
+ */
+ public static void replaceInJfaceImageRegistry( final String imageKey, final ImageDescriptor imageDescriptor )
+ {
+ Assert.isNotNull( imageKey );
+ Assert.isNotNull( imageDescriptor );
+
+ JFaceResources.getImageRegistry().remove( imageKey );
+ JFaceResources.getImageRegistry().put( imageKey, imageDescriptor );
+ }
+
+ /**
+ * Register the given ContributionManager with the given id. The contribution manager gets unregistered on control disposal.
+ *
+ * @param id the id
+ * @param contributionManager the contribution manager
+ * @param control the control
+ *
+ * @see ContributionManager
+ * @see IMenuService
+ * @see DisposeListener
+ */
+ public static void registerContributionManager( final String id, final IContributionManager contributionManager,
+ final Control control )
+ {
+ Assert.isNotNull( id );
+ Assert.isNotNull( contributionManager );
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ final IMenuService menuService = ( IMenuService ) PlatformUI.getWorkbench().getService( IMenuService.class );
+ menuService.populateContributionManager( ( ContributionManager ) contributionManager, id );
+ contributionManager.update( true );
+ control.addDisposeListener( new DisposeListener()
+ {
+ public void widgetDisposed( DisposeEvent e )
+ {
+ menuService.releaseContributions( ( ContributionManager ) contributionManager );
+ }
+ } );
+ }
+
+ /**
+ * Creates context menu to a given control.
+ *
+ * @param control the control
+ *
+ * @return the i menu manager
+ */
+ public static IMenuManager createContextMenu( final Control control )
+ {
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ MenuManager menuManager = new MenuManager();
+ menuManager.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
+
+ Menu menu = menuManager.createContextMenu( control );
+ control.setMenu( menu );
+ return menuManager;
+ }
+
+ /**
+ * Gets the dialog settings for the given identifer and plugin.
+ *
+ * @param identifier the identifier
+ * @param plugin the plugin
+ *
+ * @return the dialog settings
+ */
+ public static IDialogSettings getDialogSettings( final String identifier, final AbstractUIPlugin plugin )
+ {
+ Assert.isNotNull( plugin );
+ IDialogSettings dialogSettings = plugin.getDialogSettings();
+ IDialogSettings section = dialogSettings.getSection( identifier );
+ if ( section == null )
+ {
+ section = dialogSettings.addNewSection( identifier );
+ }
+ return section;
+ }
+
+ /**
+ * Returns the page for a given editor.
+ *
+ * @param editor the editor
+ * @return
+ *
+ * @return the page
+ *
+ * @see IWorkbenchPage
+ */
+ public static IWorkbenchPage getPage( EditorPart editor )
+ {
+ Assert.isNotNull( editor );
+ IWorkbenchPartSite site = editor.getSite();
+ Assert.isNotNull( site );
+ return site.getPage();
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,7 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+public interface CloudConnection {
+
+ public boolean performTest();
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.ObservablePojo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class CloudConnectionModel extends ObservablePojo {
+
+ public static final String PROPERTY_URL = "url";
+ public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_PASSWORD = "password";
+ public static final String PROPERTY_USERNAME = "username";
+ public static final String PROPERTY_TYPE = "type";
+
+ public static final String UNKNOWN_TYPE_LABEL = "UnknownType.label"; //$NON-NLS-1$
+ public static final String INVALID_URL = "ErrorInvalidURL.text"; //$NON-NLS-1$
+ public static final String NONCLOUD_URL = "ErrorNonCloudURL.text"; //$NON-NLS-1$
+
+ private String name;
+ private String url;
+ private String username;
+
+ private String password;
+ private String cloudType;
+
+ public static class CloudTypeConverter implements IConverter {
+
+ private static final String HTTPHEADER_KEY_ACCEPT = "Accept"; //$NON-NLS-1$
+ private static final String HTTPHEADER_VALUE_ACCEPTXML = "application/xml;q=1.0"; //$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_DRIVER = "driver"; //$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_API = "api"; //$NON-NLS-1$
+ private static final String URLCONNECTION_ENCODING = "UTF-8"; //$NON-NLS-1$
+
+ @Override
+ public Object getFromType() {
+ return String.class;
+ }
+
+ @Override
+ public Object getToType() {
+ return String.class;
+ }
+
+ @Override
+ public Object convert(final Object fromObject) {
+ return getCloudType((String) fromObject);
+ }
+
+ private String getCloudType(String url) {
+ String cloudType = UNKNOWN_TYPE_LABEL;
+ try {
+ Object o = getURLContent(url + "/api?format=xml"); //$NON-NLS-1$
+ if (o instanceof InputStream) {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document document = db.parse(
+ new InputSource(new StringReader(getXML((InputStream) o))));
+
+ NodeList elements = document.getElementsByTagName(DOCUMENT_ELEMENT_API);
+ if (elements.getLength() > 0) {
+ Node n = elements.item(0);
+ Node driver = n.getAttributes().getNamedItem(DOCUMENT_ELEMENT_DRIVER);
+ if (driver != null) {
+ String driverValue = driver.getNodeValue();
+ cloudType = driverValue.toUpperCase();
+ }
+ }
+ }
+ } catch (MalformedURLException e) {
+ cloudType = WizardMessages.getString(INVALID_URL);
+ } catch (IOException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (ParserConfigurationException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (SAXException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (Exception e) {
+ cloudType = WizardMessages.getString(INVALID_URL);
+ }
+ return cloudType;
+ }
+
+ private String getXML(InputStream is) throws UnsupportedEncodingException, IOException {
+ try {
+ if (is == null) {
+ return "";
+ }
+ StringBuilder sb = new StringBuilder();
+ String line = "";
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is, URLCONNECTION_ENCODING));
+ while ((line = reader.readLine()) != null) {
+ sb.append(line).append("\n"); //$NON-NLS-1$
+ }
+ return sb.toString();
+ } finally {
+ is.close();
+ }
+ }
+
+ private Object getURLContent(String url) throws IOException {
+ URL u = new URL(url);
+ URLConnection connection = u.openConnection();
+ connection.setRequestProperty(HTTPHEADER_KEY_ACCEPT, HTTPHEADER_VALUE_ACCEPTXML);
+ return connection.getContent();
+ }
+ }
+
+ public static class CloudTypeValidator implements IValidator {
+
+ @Override
+ public IStatus validate(Object value) {
+ Assert.isTrue(value instanceof String);
+ if (value != null
+ && !WizardMessages.getString(UNKNOWN_TYPE_LABEL).equals(value)
+ && !WizardMessages.getString(INVALID_URL).equals(value)
+ && !WizardMessages.getString(NONCLOUD_URL).equals(value)) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.error((String) value);
+ }
+ }
+ }
+
+
+ public CloudConnectionModel(String name, String url, String username, String password) {
+ this.name = name;
+ this.url = url;
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_USERNAME, this.username, this.username = username);
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_NAME, this.name, this.name = name);
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_URL, this.url, this.url = url);
+ }
+
+ public String getType() {
+ return cloudType;
+ }
+
+ public void setType(String cloudType) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_TYPE, this.cloudType, this.cloudType = cloudType);
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,433 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.net.URL;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.ISWTObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.wizard.WizardPageSupport;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.log.LogHelper;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.CompositeValidator;
+import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
+import org.jboss.tools.internal.deltacloud.ui.common.swt.JFaceUtils;
+
+/**
+ * @author Jeff Jonhston
+ * @author André Dietisheim
+ */
+public class CloudConnectionPage extends WizardPage {
+
+ private static final int CLOUDTYPE_CHECK_DELAY = 500;
+ private static final String DESCRIPTION = "NewCloudConnection.desc"; //$NON-NLS-1$
+ private static final String TITLE = "NewCloudConnection.title"; //$NON-NLS-1$
+ private static final String URL_LABEL = "Url.label"; //$NON-NLS-1$
+ private static final String NAME_LABEL = "Name.label"; //$NON-NLS-1$
+ private static final String CLOUDTYPE_LABEL = "Type.label"; //$NON-NLS-1$
+ private static final String USERNAME_LABEL = "UserName.label"; //$NON-NLS-1$
+ private static final String PASSWORD_LABEL = "Password.label"; //$NON-NLS-1$
+ private static final String TESTBUTTON_LABEL = "TestButton.label"; //$NON-NLS-1$
+ private static final String EC2_USER_INFO = "EC2UserNameLink.text"; //$NON-NLS-1$
+ private static final String EC2_PASSWORD_INFO = "EC2PasswordLink.text"; //$NON-NLS-1$
+ private static final String NAME_ALREADY_IN_USE = "ErrorNameInUse.text"; //$NON-NLS-1$
+ private static final String COULD_NOT_OPEN_BROWSER = "ErrorCouldNotOpenBrowser.text"; //$NON-NLS-1$
+ private static final String TEST_SUCCESSFUL = "NewCloudConnectionTest.success"; //$NON-NLS-1$
+ private static final String TEST_FAILURE = "NewCloudConnectionTest.failure"; //$NON-NLS-1$
+ private static final String MUST_ENTER_A_NAME = "ErrorMustNameConnection.text"; //$NON-NLS-1$
+ private static final String MUST_ENTER_A_URL = "ErrorMustProvideUrl.text"; //$NON-NLS-1$;
+
+ private CloudConnectionModel connectionModel;
+ private CloudConnection cloudConnection;
+
+ private Listener linkListener = new Listener() {
+
+ public void handleEvent(Event event) {
+ String urlString = event.text;
+ try {
+ URL url = new URL(urlString);
+ PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(url);
+ } catch (Exception e) {
+ LogHelper.logError(Activator.getDefault(),
+ WizardMessages.getFormattedString(COULD_NOT_OPEN_BROWSER, urlString), e);
+ }
+ }
+ };
+
+ public CloudConnectionPage(String pageName, CloudConnection cloudConnection) {
+ super(pageName);
+ setDescription(WizardMessages.getString(DESCRIPTION));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ this.connectionModel = new CloudConnectionModel("", "", "", "");
+ this.cloudConnection = cloudConnection;
+ }
+
+ public CloudConnectionPage(String pageName, String defaultName, String defaultUrl,
+ String defaultUsername, String defaultPassword, String defaultType,
+ CloudConnection cloudConnection) {
+ super(pageName);
+ this.connectionModel = new CloudConnectionModel(defaultName, defaultUrl, defaultUsername, defaultPassword);
+ this.cloudConnection = cloudConnection;
+ setDescription(WizardMessages.getString(DESCRIPTION));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ DataBindingContext dbc = new DataBindingContext();
+ WizardPageSupport.create(this, dbc);
+
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label dummyLabel = new Label(container, SWT.NULL);
+
+ // name
+ Label nameLabel = new Label(container, SWT.NULL);
+ nameLabel.setText(WizardMessages.getString(NAME_LABEL));
+ Text nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ bindName(dbc, nameText);
+
+ // url
+ Label urlLabel = new Label(container, SWT.NULL);
+ urlLabel.setText(WizardMessages.getString(URL_LABEL));
+ Point p1 = urlLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Text urlText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(CLOUDTYPE_CHECK_DELAY, urlText),
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_URL)
+ .observe(connectionModel),
+ new UpdateValueStrategy().setAfterGetValidator(new MandatoryStringValidator(
+ WizardMessages.getString(MUST_ENTER_A_URL))),
+ null);
+
+ // cloud type
+ Label typeLabel = new Label(container, SWT.NULL);
+ typeLabel.setText(WizardMessages.getString(CLOUDTYPE_LABEL));
+
+ Label computedTypeLabel = new Label(container, SWT.NULL);
+ Binding urlBinding = bindCloudTypeLabel(dbc, urlText, computedTypeLabel);
+
+ // username
+ Label usernameLabel = new Label(container, SWT.NULL);
+ usernameLabel.setText(WizardMessages.getString(USERNAME_LABEL));
+ Text usernameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ ControlDecoration usernameDecoration = JFaceUtils.createDecoration(usernameText, TEST_FAILURE);
+ IObservableValue usernameObservable = WidgetProperties.text(SWT.Modify).observe(usernameText);
+ dbc.bindValue(
+ usernameObservable,
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_USERNAME).observe(
+ connectionModel));
+
+ // password
+ Label passwordLabel = new Label(container, SWT.NULL);
+ passwordLabel.setText(WizardMessages.getString(PASSWORD_LABEL));
+ Text passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD | SWT.SINGLE);
+ ControlDecoration passwordDecoration = JFaceUtils.createDecoration(passwordText, TEST_FAILURE);
+ ISWTObservableValue passwordTextObservable = WidgetProperties.text(SWT.Modify).observe(passwordText);
+ dbc.bindValue(
+ passwordTextObservable,
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_PASSWORD).observe(
+ connectionModel));
+ // test button
+ final Button testButton = new Button(container, SWT.NULL);
+ testButton.setText(WizardMessages.getString(TESTBUTTON_LABEL));
+ testButton.setEnabled(false);
+ urlBinding.getValidationStatus().addValueChangeListener(enableButtonOnUrlValidityChanges(testButton));
+
+ CredentialsTestAdapter credentialsTestAdapter = new CredentialsTestAdapter(usernameDecoration,
+ passwordDecoration);
+ testButton.addSelectionListener(credentialsTestAdapter);
+ usernameObservable.addValueChangeListener(credentialsTestAdapter);
+ passwordTextObservable.addValueChangeListener(credentialsTestAdapter);
+
+ // ec2 user link
+ Link ec2userLink = new Link(container, SWT.NULL);
+ ec2userLink.setText(WizardMessages.getString(EC2_USER_INFO));
+ ec2userLink.addListener(SWT.Selection, linkListener);
+
+ // ec2 pw link
+ Link ec2pwLink = new Link(container, SWT.NULL);
+ ec2pwLink.setText(WizardMessages.getString(EC2_PASSWORD_INFO));
+ ec2pwLink.addListener(SWT.Selection, linkListener);
+
+ FormData f = new FormData();
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ dummyLabel.setLayoutData(f);
+
+ Point p2 = urlText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8 + centering);
+ nameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8);
+ f.left = new FormAttachment(usernameLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ nameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameText, 5 + centering);
+ urlLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(nameText, 0, SWT.LEFT);
+ f.top = new FormAttachment(nameText, 5);
+ f.right = new FormAttachment(100, 0);
+ urlText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(urlText, 5 + centering);
+ typeLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(urlText, 0, SWT.LEFT);
+ f.top = new FormAttachment(urlText, 5 + centering);
+ f.right = new FormAttachment(100, 0);
+ computedTypeLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(typeLabel, 10 + centering);
+ usernameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(computedTypeLabel, 0, SWT.LEFT);
+ f.top = new FormAttachment(computedTypeLabel, 10);
+ f.right = new FormAttachment(100, -70);
+ usernameText.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(usernameText, 0, SWT.LEFT);
+ f.top = new FormAttachment(usernameText, 5);
+ ec2userLink.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(ec2userLink, 5 + centering);
+ passwordLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(usernameText, 0, SWT.LEFT);
+ f.top = new FormAttachment(ec2userLink, 5);
+ f.right = new FormAttachment(100, -70);
+ passwordText.setLayoutData(f);
+
+ f = new FormData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = testButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.left = new FormAttachment(usernameText, 10);
+ f.top = new FormAttachment(usernameText, 0);
+ f.right = new FormAttachment(100, 0);
+ testButton.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(passwordText, 0, SWT.LEFT);
+ f.top = new FormAttachment(passwordText, 5);
+ ec2pwLink.setLayoutData(f);
+
+ setControl(container);
+ }
+
+ /**
+ * Enables/Disables (credentials) test button on url validity changes.
+ *
+ * @param testButton
+ * the test button
+ * @return the i value change listener
+ */
+ private IValueChangeListener enableButtonOnUrlValidityChanges(final Button testButton) {
+ return new IValueChangeListener() {
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ testButton.setEnabled(status.isOK());
+ }
+ };
+ }
+
+ /**
+ * Displays the cloud type in the given if the given binding is valid.
+ *
+ * @param typeLabel
+ * the type label
+ * @return the value change listener
+ */
+ private class CloudTypeAdapter implements IValueChangeListener {
+
+ private Label typeLabel;
+
+ public CloudTypeAdapter(Label typeLabel) {
+ this.typeLabel = typeLabel;
+ }
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ if (status.isOK()) {
+ typeLabel.setText(connectionModel.getType());
+ } else {
+ typeLabel.setText("");
+ }
+ }
+ }
+
+ /**
+ * Binds the given cloud type label to the given url text widget. Attaches a
+ * listener to the url text widget Adds a validity decorator to the url text
+ * widget.
+ *
+ * @param dbc
+ * the databinding context to use
+ * @param urlText
+ * the url text widget
+ * @param typeLabel
+ * the cloud type label to display the cloud type in
+ * @return
+ * @return the binding that was created
+ */
+ private Binding bindCloudTypeLabel(DataBindingContext dbc, Text urlText, final Label typeLabel) {
+ UpdateValueStrategy updateStrategy = new UpdateValueStrategy();
+ updateStrategy.setConverter(new CloudConnectionModel.CloudTypeConverter());
+ updateStrategy.setBeforeSetValidator(new CloudConnectionModel.CloudTypeValidator());
+
+ Binding binding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(100, urlText),
+ BeanProperties.value(CloudConnectionModel.PROPERTY_TYPE).observe(connectionModel),
+ updateStrategy,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ binding.getValidationStatus().addValueChangeListener(new CloudTypeAdapter(typeLabel));
+ ControlDecorationSupport.create(binding, SWT.LEFT | SWT.TOP);
+ return binding;
+ }
+
+ /**
+ * Bind the given name text wdiget to the cloud connection model. Attaches
+ * validators to the binding that enforce unique user input.
+ *
+ * @param dbc
+ * the databinding context to use
+ * @param nameText
+ * the name text widget to bind
+ */
+ private void bindName(DataBindingContext dbc, final Text nameText) {
+ Binding nameTextBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(nameText),
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_NAME)
+ .observe(connectionModel),
+ new UpdateValueStrategy().setBeforeSetValidator(
+ new CompositeValidator(
+ new MandatoryStringValidator(WizardMessages.getString(MUST_ENTER_A_NAME)),
+ new IValidator() {
+
+ @Override
+ public IStatus validate(Object value) {
+ if (nameText.getText() != null
+ && DeltaCloudManager.getDefault().findCloud(nameText.getText()) != null) {
+ return ValidationStatus
+ .error(WizardMessages.getString(NAME_ALREADY_IN_USE));
+ } else {
+ return ValidationStatus.ok();
+ }
+ }
+ })),
+ null);
+ ControlDecorationSupport.create(nameTextBinding, SWT.LEFT | SWT.TOP);
+ }
+
+ public CloudConnectionModel getModel() {
+ return connectionModel;
+ }
+
+ private class CredentialsTestAdapter extends SelectionAdapter implements IValueChangeListener {
+
+ private ControlDecoration[] controlDecorations;
+
+ public CredentialsTestAdapter(ControlDecoration... controlDecorations) {
+ this.controlDecorations = controlDecorations;
+ setDecorations(false);
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+ boolean success = cloudConnection.performTest();
+ setMessage(success);
+ setDecorations(!success);
+ }
+
+ private void setMessage(boolean success) {
+ if (success) {
+ CloudConnectionPage.this.setMessage(WizardMessages.getString(TEST_SUCCESSFUL));
+ } else {
+ CloudConnectionPage.this.setErrorMessage(WizardMessages.getString(TEST_FAILURE));
+ }
+ }
+
+ private void clearMessage() {
+ CloudConnectionPage.this.setMessage(""); //$NON-NLS-1$
+ }
+
+ private void setDecorations(boolean visible) {
+ for (ControlDecoration controlDecoration : controlDecorations) {
+ if (visible) {
+ controlDecoration.show();
+ } else {
+ controlDecoration.hide();
+ }
+ }
+ }
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ setDecorations(false);
+ clearMessage();
+ }
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,27 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+public class CustomWizardDialog extends WizardDialog {
+
+ private String finishText;
+
+ public CustomWizardDialog(Shell parentShell, IWizard newWizard, String finishText) {
+ super(parentShell, newWizard);
+ this.finishText = finishText;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ // All we want to do is override the text for the finish button
+ Button finishButton = getButton(IDialogConstants.FINISH_ID);
+ finishButton.setText(finishText);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.net.MalformedURLException;
+
+import org.eclipse.equinox.security.storage.ISecurePreferences;
+import org.eclipse.equinox.security.storage.SecurePreferencesFactory;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.ui.Activator;
+
+public class EditCloudConnection extends Wizard implements INewWizard, CloudConnection {
+
+ private static final String MAINPAGE_NAME = "EditCloudConnection.name"; //$NON-NLS-1$
+ private CloudConnectionPage mainPage;
+ private DeltaCloud cloud;
+
+ public EditCloudConnection(DeltaCloud cloud) {
+ super();
+ this.cloud = cloud;
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ @Override
+ public void addPages() {
+ String password = "";
+ String key = DeltaCloud.getPreferencesKey(cloud.getURL(), cloud.getUsername());
+ ISecurePreferences root = SecurePreferencesFactory.getDefault();
+ ISecurePreferences node = root.node(key);
+ try {
+ password = node.get("password", null); //$NON-NLS-1$
+ } catch (Exception e) {
+ Activator.log(e);
+ }
+ mainPage = new CloudConnectionPage(WizardMessages.getString(MAINPAGE_NAME),
+ cloud.getName(), cloud.getURL(), cloud.getUsername(), password,
+ cloud.getType(), this);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ public boolean performTest() {
+ String name = mainPage.getName();
+ String url = mainPage.getModel().getUrl();
+ String username = mainPage.getModel().getUsername();
+ String password = mainPage.getModel().getPassword();
+ try {
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password);
+ return newCloud.testConnection();
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ return false;
+ }
+ }
+
+ @Override
+ public boolean performFinish() {
+ String name = mainPage.getName();
+ String url = mainPage.getModel().getUrl();
+ String username = mainPage.getModel().getUsername();
+ String password = mainPage.getModel().getPassword();
+ String type = mainPage.getModel().getType();
+ try {
+ String oldName = cloud.getName();
+ cloud.editCloud(name, url, username, password, type);
+ if (!name.equals(oldName))
+ DeltaCloudManager.getDefault().notifyCloudRename();
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ }
+ return true;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,42 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+
+public class ImageFilter extends Wizard {
+
+ private DeltaCloud cloud;
+ private ImageFilterPage mainPage;
+
+ public ImageFilter(DeltaCloud cloud) {
+ this.cloud = cloud;
+ }
+
+ @Override
+ public void addPages() {
+ // TODO Auto-generated method stub
+ mainPage = new ImageFilterPage(cloud);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ String nameRule = mainPage.getNameRule();
+ String idRule = mainPage.getIdRule();
+ String archRule = mainPage.getArchRule();
+ String descRule = mainPage.getDescRule();
+
+ cloud.createImageFilter(nameRule + ";" + //$NON-NLS-1$
+ idRule + ";" + //$NON-NLS-1$
+ archRule + ";" + //$NON-NLS-1$
+ descRule); //$NON-NLS-1$
+
+ return true;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,252 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+public class ImageFilterPage extends WizardPage {
+
+ private final static String NAME = "ImageFilter.name"; //$NON-NLS-1$
+ private final static String TITLE = "ImageFilter.title"; //$NON-NLS-1$
+ private final static String DESC = "ImageFilter.desc"; //$NON-NLS-1$
+ private final static String FILTER_LABEL = "ImageFilter.label"; //$NON-NLS-1$
+ private final static String EMPTY_RULE = "ErrorFilterEmptyRule.msg"; //$NON-NLS-1$
+ private final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg"; //$NON-NLS-1$
+ private final static String NAME_LABEL = "Name.label"; //$NON-NLS-1$
+ private final static String ID_LABEL = "Id.label"; //$NON-NLS-1$
+ private final static String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
+ private final static String DESC_LABEL = "Desc.label"; //$NON-NLS-1$
+ private final static String DEFAULT_LABEL = "DefaultButton.label"; //$NON-NLS-1$
+
+ private DeltaCloud cloud;
+ private Text nameText;
+ private Text idText;
+ private Text archText;
+ private Text descText;
+
+ private Button defaultName;
+ private Button defaultId;
+ private Button defaultArch;
+ private Button defaultDesc;
+
+ public ImageFilterPage(DeltaCloud cloud) {
+ super(WizardMessages.getString(NAME));
+ this.cloud = cloud;
+ setDescription(WizardMessages.getString(DESC));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ public String getNameRule() {
+ return nameText.getText();
+ }
+
+ public String getIdRule() {
+ return idText.getText();
+ }
+
+ public String getArchRule() {
+ return archText.getText();
+ }
+
+ public String getDescRule() {
+ return descText.getText();
+ }
+
+ private ModifyListener Listener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ // TODO Auto-generated method stub
+ validate();
+ }
+ };
+
+ private SelectionAdapter ButtonListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button b = (Button)e.widget;
+ if (b == defaultName)
+ nameText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultId)
+ idText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultArch)
+ archText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultDesc)
+ descText.setText("*"); //$NON-NLS-1$
+ }
+
+ };
+
+ private void validate() {
+ boolean complete = true;
+ boolean error = false;
+
+ if (nameText.getText().length() == 0 ||
+ idText.getText().length() == 0 ||
+ archText.getText().length() == 0 ||
+ descText.getText().length() == 0) {
+
+ setErrorMessage(WizardMessages.getString(EMPTY_RULE));
+ error = true;
+ } else if (nameText.getText().contains(";") ||
+ idText.getText().contains(";") ||
+ archText.getText().contains(";") ||
+ descText.getText().contains(";")) {
+ setErrorMessage(WizardMessages.getString(INVALID_SEMICOLON));
+ error = true;
+ }
+
+ if (!error)
+ setErrorMessage(null);
+ setPageComplete(complete && !error);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label label = new Label(container, SWT.NULL);
+ label.setText(WizardMessages.getString(FILTER_LABEL));
+
+ Label nameLabel = new Label(container, SWT.NULL);
+ nameLabel.setText(WizardMessages.getString(NAME_LABEL));
+
+ nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ nameText.setText(cloud.getImageFilter().getNameRule().toString());
+ nameText.addModifyListener(Listener);
+
+ defaultName = new Button(container, SWT.NULL);
+ defaultName.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultName.addSelectionListener(ButtonListener);
+
+ Label idLabel = new Label(container, SWT.NULL);
+ idLabel.setText(WizardMessages.getString(ID_LABEL));
+
+ idText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ idText.setText(cloud.getImageFilter().getIdRule().toString());
+ idText.addModifyListener(Listener);
+
+ defaultId = new Button(container, SWT.NULL);
+ defaultId.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultId.addSelectionListener(ButtonListener);
+
+ Label archLabel = new Label(container, SWT.NULL);
+ archLabel.setText(WizardMessages.getString(ARCH_LABEL));
+
+ archText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ archText.setText(cloud.getImageFilter().getArchRule().toString());
+ archText.addModifyListener(Listener);
+
+ defaultArch = new Button(container, SWT.NULL);
+ defaultArch.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultArch.addSelectionListener(ButtonListener);
+
+ Label descLabel = new Label(container, SWT.NULL);
+ descLabel.setText(WizardMessages.getString(DESC_LABEL));
+
+ descText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ descText.setText(cloud.getImageFilter().getDescRule().toString());
+ descText.addModifyListener(Listener);
+
+ defaultDesc = new Button(container, SWT.NULL);
+ defaultDesc.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultDesc.addSelectionListener(ButtonListener);
+
+ Point p1 = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p3 = defaultName.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+ int centering2 = (p3.y - p2.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.top = new FormAttachment(0);
+ label.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ nameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11);
+ f.right = new FormAttachment(100);
+ defaultName.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11 + centering2);
+ f.left = new FormAttachment(archLabel, 5);
+ f.right = new FormAttachment(defaultName, -10);
+ nameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ idLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11 + centering2);
+ f.left = new FormAttachment(archLabel, 5);
+ f.right = new FormAttachment(defaultId, -10);
+ idText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ archLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultArch.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11 + centering2);
+ f.left = new FormAttachment(archLabel, 5);
+ f.right = new FormAttachment(defaultArch, -10);
+ archText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(archLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ descLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(archLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultDesc.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(archLabel, 11 + centering2);
+ f.left = new FormAttachment(archLabel, 5);
+ f.right = new FormAttachment(defaultDesc, -10);
+ descText.setLayoutData(f);
+
+ setControl(container);
+ setPageComplete(true);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,48 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+
+public class InstanceFilter extends Wizard {
+
+ private DeltaCloud cloud;
+ private InstanceFilterPage mainPage;
+
+ public InstanceFilter(DeltaCloud cloud) {
+ this.cloud = cloud;
+ }
+
+ @Override
+ public void addPages() {
+ // TODO Auto-generated method stub
+ mainPage = new InstanceFilterPage(cloud);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ String nameRule = mainPage.getNameRule();
+ String idRule = mainPage.getIdRule();
+ String imageIdRule = mainPage.getImageIdRule();
+ String ownerIdRule = mainPage.getOwnerIdRule();
+ String keyNameRule = mainPage.getKeyNameRule();
+ String realmRule = mainPage.getRealmRule();
+ String profileRule = mainPage.getProfileRule();
+
+ cloud.createInstanceFilter(nameRule + ";" + //$NON-NLS-1$
+ idRule + ";" + //$NON-NLS-1$
+ imageIdRule + ";" + //$NON-NLS-1$
+ ownerIdRule + ";" + //$NON-NLS-1$
+ keyNameRule + ";" + //$NON-NLS-1$
+ realmRule + ";" + //$NON-NLS-1$
+ profileRule); //$NON-NLS-1$
+
+ return true;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,366 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+public class InstanceFilterPage extends WizardPage {
+
+ private final static String NAME = "InstanceFilter.name"; //$NON-NLS-1$
+ private final static String TITLE = "InstanceFilter.title"; //$NON-NLS-1$
+ private final static String DESC = "InstanceFilter.desc"; //$NON-NLS-1$
+ private final static String FILTER_LABEL = "InstanceFilter.label"; //$NON-NLS-1$
+ private final static String EMPTY_RULE = "ErrorFilterEmptyRule.msg"; //$NON-NLS-1$
+ private final static String INVALID_SEMICOLON = "ErrorFilterSemicolon.msg"; //$NON-NLS-1$
+ private final static String NAME_LABEL = "Name.label"; //$NON-NLS-1$
+ private final static String ID_LABEL = "Id.label"; //$NON-NLS-1$
+ private final static String OWNER_ID_LABEL = "OwnerId.label"; //$NON-NLS-1$
+ private final static String IMAGE_ID_LABEL = "ImageId.label"; //$NON-NLS-1$
+ private final static String KEYNAME_LABEL = "Key.label"; //$NON-NLS-1$
+ private final static String REALM_LABEL = "Realm.label"; //$NON-NLS-1$
+ private final static String PROFILE_LABEL = "Profile.label"; //$NON-NLS-1$
+ private final static String DEFAULT_LABEL = "DefaultButton.label"; //$NON-NLS-1$
+
+ private DeltaCloud cloud;
+ private Text nameText;
+ private Text idText;
+ private Text imageIdText;
+ private Text ownerIdText;
+ private Text keyNameText;
+ private Text realmText;
+ private Text profileText;
+
+ private Button defaultName;
+ private Button defaultId;
+ private Button defaultImageId;
+ private Button defaultOwnerId;
+ private Button defaultKeyId;
+ private Button defaultRealm;
+ private Button defaultProfile;
+
+ public InstanceFilterPage(DeltaCloud cloud) {
+ super(WizardMessages.getString(NAME));
+ this.cloud = cloud;
+ setDescription(WizardMessages.getString(DESC));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ public String getNameRule() {
+ return nameText.getText();
+ }
+
+ public String getIdRule() {
+ return idText.getText();
+ }
+
+ public String getImageIdRule() {
+ return imageIdText.getText();
+ }
+
+ public String getOwnerIdRule() {
+ return ownerIdText.getText();
+ }
+
+ public String getKeyNameRule() {
+ return keyNameText.getText();
+ }
+
+ public String getRealmRule() {
+ return realmText.getText();
+ }
+
+ public String getProfileRule() {
+ return profileText.getText();
+ }
+
+ private ModifyListener Listener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ // TODO Auto-generated method stub
+ validate();
+ }
+ };
+
+ private SelectionAdapter ButtonListener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button b = (Button)e.widget;
+ if (b == defaultName)
+ nameText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultId)
+ idText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultImageId)
+ imageIdText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultOwnerId)
+ ownerIdText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultKeyId)
+ keyNameText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultRealm)
+ realmText.setText("*"); //$NON-NLS-1$
+ else if (b == defaultProfile)
+ profileText.setText("*"); //$NON-NLS-1$
+ }
+
+ };
+
+ private void validate() {
+ boolean complete = true;
+ boolean error = false;
+
+ if (nameText.getText().length() == 0 ||
+ idText.getText().length() == 0 ||
+ imageIdText.getText().length() == 0 ||
+ ownerIdText.getText().length() == 0 ||
+ keyNameText.getText().length() == 0 ||
+ realmText.getText().length() == 0 ||
+ profileText.getText().length() == 0) {
+
+ setErrorMessage(WizardMessages.getString(EMPTY_RULE));
+ error = true;
+ } else if (nameText.getText().contains(";") ||
+ idText.getText().contains(";") ||
+ imageIdText.getText().contains(";") ||
+ ownerIdText.getText().contains(";") ||
+ keyNameText.getText().contains(";") ||
+ realmText.getText().contains(";") ||
+ profileText.getText().contains(";")) {
+ setErrorMessage(WizardMessages.getString(INVALID_SEMICOLON));
+ error = true;
+ }
+
+ if (!error)
+ setErrorMessage(null);
+ setPageComplete(complete && !error);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label label = new Label(container, SWT.NULL);
+ label.setText(WizardMessages.getString(FILTER_LABEL));
+
+ Label nameLabel = new Label(container, SWT.NULL);
+ nameLabel.setText(WizardMessages.getString(NAME_LABEL));
+
+ nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ nameText.setText(cloud.getInstanceFilter().getNameRule().toString());
+ nameText.addModifyListener(Listener);
+
+ defaultName = new Button(container, SWT.NULL);
+ defaultName.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultName.addSelectionListener(ButtonListener);
+
+ Label idLabel = new Label(container, SWT.NULL);
+ idLabel.setText(WizardMessages.getString(ID_LABEL));
+
+ idText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ idText.setText(cloud.getInstanceFilter().getIdRule().toString());
+ idText.addModifyListener(Listener);
+
+ defaultId = new Button(container, SWT.NULL);
+ defaultId.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultId.addSelectionListener(ButtonListener);
+
+ Label imageIdLabel = new Label(container, SWT.NULL);
+ imageIdLabel.setText(WizardMessages.getString(IMAGE_ID_LABEL));
+
+ imageIdText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ imageIdText.setText(cloud.getInstanceFilter().getImageIdRule().toString());
+ imageIdText.addModifyListener(Listener);
+
+ defaultImageId = new Button(container, SWT.NULL);
+ defaultImageId.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultImageId.addSelectionListener(ButtonListener);
+
+ Label ownerIdLabel = new Label(container, SWT.NULL);
+ ownerIdLabel.setText(WizardMessages.getString(OWNER_ID_LABEL));
+
+ ownerIdText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ ownerIdText.setText(cloud.getInstanceFilter().getOwnerIdRule().toString());
+ ownerIdText.addModifyListener(Listener);
+
+ defaultOwnerId = new Button(container, SWT.NULL);
+ defaultOwnerId.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultOwnerId.addSelectionListener(ButtonListener);
+
+ Label keyNameLabel = new Label(container, SWT.NULL);
+ keyNameLabel.setText(WizardMessages.getString(KEYNAME_LABEL));
+
+ keyNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ keyNameText.setText(cloud.getInstanceFilter().getKeyNameRule().toString());
+ keyNameText.addModifyListener(Listener);
+
+ defaultKeyId = new Button(container, SWT.NULL);
+ defaultKeyId.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultKeyId.addSelectionListener(ButtonListener);
+
+ Label realmLabel = new Label(container, SWT.NULL);
+ realmLabel.setText(WizardMessages.getString(REALM_LABEL));
+
+ realmText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ realmText.setText(cloud.getInstanceFilter().getRealmRule().toString());
+ realmText.addModifyListener(Listener);
+
+ defaultRealm = new Button(container, SWT.NULL);
+ defaultRealm.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultRealm.addSelectionListener(ButtonListener);
+
+ Label profileLabel = new Label(container, SWT.NULL);
+ profileLabel.setText(WizardMessages.getString(PROFILE_LABEL));
+
+ profileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ profileText.setText(cloud.getInstanceFilter().getProfileRule().toString());
+ profileText.addModifyListener(Listener);
+
+ defaultProfile = new Button(container, SWT.NULL);
+ defaultProfile.setText(WizardMessages.getString(DEFAULT_LABEL));
+ defaultProfile.addSelectionListener(ButtonListener);
+
+ Point p1 = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p3 = defaultName.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+ int centering2 = (p3.y - p2.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.top = new FormAttachment(0);
+ label.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ nameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11);
+ f.right = new FormAttachment(100);
+ defaultName.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(label, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultName, -10);
+ nameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ idLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultId, -10);
+ idText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ imageIdLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultImageId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(idLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultImageId, -10);
+ imageIdText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageIdLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ ownerIdLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageIdLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultOwnerId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageIdLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultOwnerId, -10);
+ ownerIdText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(ownerIdLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ keyNameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(ownerIdLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultKeyId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(ownerIdLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultKeyId, -10);
+ keyNameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(keyNameLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ realmLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(keyNameLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultRealm.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(keyNameLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultRealm, -10);
+ realmText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realmLabel, 11 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ profileLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realmLabel, 11);
+ f.right = new FormAttachment(100);
+ defaultProfile.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realmLabel, 11 + centering2);
+ f.left = new FormAttachment(profileLabel, 5);
+ f.right = new FormAttachment(defaultProfile, -10);
+ profileText.setLayoutData(f);
+
+ setControl(container);
+ setPageComplete(true);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,43 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+
+public class ManageKeys extends Wizard {
+
+ private DeltaCloud cloud;
+ private String fileExtension;
+ private ManageKeysPage mainPage;
+ private String keyname;
+
+ public ManageKeys(DeltaCloud cloud, String fileExtension) {
+ this.cloud = cloud;
+ this.fileExtension = fileExtension;
+ }
+
+ public String getKeyName() {
+ return keyname;
+ }
+
+ @Override
+ public void addPages() {
+ // TODO Auto-generated method stub
+ mainPage = new ManageKeysPage(cloud, fileExtension);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ String currFile = mainPage.getCurrFile();
+ keyname = currFile.substring(0,
+ currFile.length() - fileExtension.length());
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,299 @@
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.osgi.service.prefs.Preferences;
+
+public class ManageKeysPage extends WizardPage {
+
+ private final static String NAME = "ManageKeys.name"; //$NON-NLS-1$
+ private final static String TITLE = "ManageKeys.title"; //$NON-NLS-1$
+ private final static String DESC = "ManageKeys.desc"; //$NON-NLS-1$
+ private final static String DIR_LABEL = "Directory.label"; //$NON-NLS-1$
+ private final static String BROWSE_LABEL = "BrowseButton.label"; //$NON-NLS-1$
+ private final static String NEW = "NewButton.label"; //$NON-NLS-1$
+ private final static String DELETE = "DeleteButton.label"; //$NON-NLS-1$
+ private final static String CREATE_KEY_TITLE = "CreateKey.title"; //$NON-NLS-1$
+ private final static String CREATE_KEY_MSG = "CreateKey.msg"; //$NON-NLS-1$
+ private final static String CONFIRM_KEY_DELETE_TITLE = "ConfirmKeyDelete.title"; //$NON-NLS-1$
+ private final static String CONFIRM_KEY_DELETE_MSG = "ConfirmKeyDelete.msg"; //$NON-NLS-1$
+
+ private final static String INVALID_DIRECTORY = "ErrorInvalidDirectory.text"; //$NON-NLS-1$
+
+ private DeltaCloud cloud;
+ private String fileExtension;
+ private String currFile;
+
+ private Text directory;
+ private List fileList;
+
+ private ModifyListener dirListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ // TODO Auto-generated method stub
+ validate();
+ }
+
+ };
+
+ private SelectionListener browseButtonListener = new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Display display = Display.getDefault();
+ Shell shell = new Shell(display);
+ DirectoryDialog d = new DirectoryDialog(shell);
+ String text = d.open();
+ if (text != null)
+ directory.setText(text);
+ }
+
+ };
+
+ private SelectionListener createButtonListener = new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Display display = Display.getDefault();
+ Shell shell = new Shell(display);
+ String directoryText = directory.getText();
+ InputDialog d = new InputDialog(shell, WizardMessages.getString(CREATE_KEY_TITLE),
+ WizardMessages.getString(CREATE_KEY_MSG),
+ "",
+ null);
+ d.setBlockOnOpen(true);
+ d.create();
+ int retcode = d.open();
+ if (retcode == InputDialog.OK) {
+ String keyname = d.getValue();
+ try {
+ cloud.createKey(keyname, directoryText);
+ loadFileList();
+ } catch (DeltaCloudException dce) {
+ MessageDialog.openError(getShell(), null, dce.getLocalizedMessage());
+ }
+ }
+ }
+
+ };
+
+ private SelectionListener fileListListener = new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ currFile = fileList.getSelection()[0];
+ }
+
+ };
+
+ private FilenameFilter extensionFilter = new FilenameFilter() {
+
+ @Override
+ public boolean accept(File arg0, String arg1) {
+ if (arg1.endsWith(fileExtension))
+ return true;
+ return false;
+ }
+
+ };
+
+ public ManageKeysPage(DeltaCloud cloud, String fileExtension) {
+ super(WizardMessages.getString(NAME));
+ this.cloud = cloud;
+ this.fileExtension = fileExtension;
+ setDescription(WizardMessages.getString(DESC));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ public String getCurrFile() {
+ return currFile;
+ }
+
+ private void validate() {
+ boolean hasError = false;
+ boolean isComplete = true;
+
+ if (directory.getText().length() == 0)
+ isComplete = false;
+ else {
+ File f = new File(directory.getText());
+ if (!f.exists() || !f.isDirectory()) {
+ hasError = true;
+ setErrorMessage(WizardMessages.getString(INVALID_DIRECTORY));
+ } else {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ try {
+ prefs.put(IDeltaCloudPreferenceConstants.DEFAULT_KEY_DIR, directory.getText());
+ } catch(Exception e) {
+ // do nothing
+ }
+ loadFileList();
+ }
+ }
+ if (!hasError)
+ setErrorMessage(null);
+ setPageComplete(isComplete && !hasError);
+ }
+
+ private void loadFileList() {
+ File dir = new File(directory.getText());
+ if (dir.exists() && dir.isDirectory()) {
+ File[] files = dir.listFiles(extensionFilter);
+ Arrays.sort(files, new Comparator<File>() {
+ @Override
+ public int compare(File arg0, File arg1) {
+ String name0 = arg0.getName();
+ String name1 = arg1.getName();
+ return name0.compareTo(name1);
+ }
+ });
+ fileList.removeAll();
+ for (File f : files) {
+ fileList.add(f.getName());
+ }
+ }
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ // TODO Auto-generated method stub
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label dirLabel = new Label(container, SWT.NULL);
+ dirLabel.setText(WizardMessages.getString(DIR_LABEL));
+
+ directory = new Text(container, SWT.BORDER | SWT.SINGLE);
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String defaultDir = prefs.get(IDeltaCloudPreferenceConstants.DEFAULT_KEY_DIR, System.getProperty("user.home"));
+ directory.setText(defaultDir);
+ directory.addModifyListener(dirListener);
+
+ Button browseButton = new Button(container, SWT.NULL);
+ browseButton.setText(WizardMessages.getString(BROWSE_LABEL));
+ browseButton.addSelectionListener(browseButtonListener);
+
+ fileList = new List(container, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
+ fileList.addSelectionListener(fileListListener);
+
+ Button createButton = new Button(container, SWT.NULL);
+ createButton.setText(WizardMessages.getString(NEW));
+ createButton.addSelectionListener(createButtonListener);
+
+ Button deleteButton = new Button(container, SWT.NULL);
+ deleteButton.setText(WizardMessages.getString(DELETE));
+ deleteButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ final String keyName = fileList.getSelection()[0];
+ boolean confirmed = MessageDialog.openConfirm(getShell(),
+ WizardMessages.getString(CONFIRM_KEY_DELETE_TITLE),
+ WizardMessages.getFormattedString(CONFIRM_KEY_DELETE_MSG, keyName));
+ if (confirmed) {
+ try {
+ cloud.deleteKey(keyName.substring(0, keyName.length() - fileExtension.length()));
+ File f = new File(directory.getText());
+ File[] files = f.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.equals(keyName);
+ }
+ });
+ if (files.length == 1) {
+ if (files[0].delete())
+ fileList.remove(fileList.getSelectionIndex());
+ }
+ } catch (DeltaCloudException dce) {
+ MessageDialog.openError(getShell(), null, dce.getLocalizedMessage());
+ }
+ }
+ }
+ });
+
+ Point p1 = dirLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = directory.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p3 = browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+ int centering2 = (p3.y - p2.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.left = new FormAttachment(0, 5);
+ f.top = new FormAttachment(0, 5 + centering + centering2);
+ dirLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.right = new FormAttachment(100, -10);
+ f.top = new FormAttachment(0, 5);
+ browseButton.setLayoutData(f);
+
+ f = new FormData();
+ f.left = new FormAttachment(dirLabel, 5);
+ f.top = new FormAttachment(0, 5 + centering2);
+ f.right = new FormAttachment(browseButton, -10);
+ directory.setLayoutData(f);
+
+ f = new FormData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = deleteButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.right = new FormAttachment(100, -20);
+ f.bottom = new FormAttachment(100, -10);
+ deleteButton.setLayoutData(f);
+
+ f = new FormData();
+ minSize = deleteButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.right = new FormAttachment(deleteButton, -10);
+ f.bottom = new FormAttachment(100, -10);
+ createButton.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(directory, 10);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(createButton, -10);
+ fileList.setLayoutData(f);
+
+ setControl(container);
+ loadFileList();
+ validate();
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.net.MalformedURLException;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.ui.Activator;
+
+public class NewCloudConnection extends Wizard implements INewWizard, CloudConnection {
+
+ private static final String MAINPAGE_NAME = "NewCloudConnection.name"; //$NON-NLS-1$
+ private CloudConnectionPage mainPage;
+
+ public NewCloudConnection() {
+ super();
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ @Override
+ public void addPages() {
+ mainPage = new CloudConnectionPage(WizardMessages.getString(MAINPAGE_NAME), this);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ public boolean performTest() {
+ String name = mainPage.getName();
+ String url = mainPage.getModel().getUrl();
+ String username = mainPage.getModel().getUsername();
+ String password = mainPage.getModel().getPassword();
+ try {
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password);
+ return newCloud.testConnection();
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ return false;
+ }
+ }
+
+ @Override
+ public boolean performFinish() {
+ String name = mainPage.getModel().getName();
+ String url = mainPage.getModel().getUrl();
+ String username = mainPage.getModel().getUsername();
+ String password = mainPage.getModel().getPassword();
+ String type = mainPage.getModel().getType();
+ try {
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, type, true);
+ DeltaCloudManager.getDefault().addCloud(newCloud);
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ }
+ return true;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.rse.core.IRSECoreRegistry;
+import org.eclipse.rse.core.IRSESystemType;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.rse.core.model.SystemStartHere;
+import org.eclipse.rse.core.subsystems.IConnectorService;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.osgi.service.prefs.Preferences;
+
+public class NewInstance extends Wizard {
+
+ private final static String CREATE_INSTANCE_FAILURE_TITLE = "CreateInstanceError.title"; //$NON-NLS-1$
+ private final static String CREATE_INSTANCE_FAILURE_MSG = "CreateInstanceError.msg"; //$NON-NLS-1$
+ private final static String DEFAULT_REASON = "CreateInstanceErrorReason.msg"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_TITLE = "ConfirmCreate.title"; //$NON-NLS-1$
+ private final static String CONFIRM_CREATE_MSG = "ConfirmCreate.msg"; //$NON-NLS-1$
+ private final static String DONT_SHOW_THIS_AGAIN_MSG = "DontShowThisAgain.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_TITLE = "StartingInstance.title"; //$NON-NLS-1$
+ private final static String RSE_CONNECTING_MSG = "ConnectingRSE.msg"; //$NON-NLS-1$
+
+
+ private NewInstancePage mainPage;
+
+ private DeltaCloud cloud;
+ private DeltaCloudImage image;
+ private DeltaCloudInstance instance;
+
+ public NewInstance(DeltaCloud cloud, DeltaCloudImage image) {
+ this.cloud = cloud;
+ this.image = image;
+ }
+
+ @Override
+ public void addPages() {
+ // TODO Auto-generated method stub
+ mainPage = new NewInstancePage(cloud, image);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+
+ private class WatchCreateJob extends Job {
+
+ private DeltaCloud cloud;
+ private String instanceId;
+ private String instanceName;
+
+ public WatchCreateJob(String title, DeltaCloud cloud,
+ String instanceId, String instanceName) {
+ super(title);
+ this.cloud = cloud;
+ this.instanceId = instanceId;
+ this.instanceName = instanceName;
+ }
+
+ public IStatus run(IProgressMonitor pm) {
+ if (!pm.isCanceled()){
+ DeltaCloudInstance instance = null;
+ try {
+ pm.beginTask(WizardMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {instanceName}), IProgressMonitor.UNKNOWN);
+ pm.worked(1);
+ cloud.registerActionJob(instanceId, this);
+ boolean finished = false;
+ while (!finished && !pm.isCanceled()) {
+ instance = cloud.refreshInstance(instanceId);
+ if (instance != null && !instance.getState().equals(DeltaCloudInstance.PENDING))
+ break;
+ Thread.sleep(400);
+ }
+
+ } catch (Exception e) {
+ // do nothing
+ } finally {
+ cloud.addReplaceInstance(instance);
+ cloud.removeActionJob(instanceId, this);
+ String hostname = instance.getHostName();
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ boolean autoConnect = prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
+ if (hostname != null && hostname.length() > 0 && autoConnect) {
+ ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+ RSECorePlugin rsep = RSECorePlugin.getDefault();
+ IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
+ IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
+ IRSESystemType sshType = null;
+ for (IRSESystemType sysType : sysTypes) {
+ if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
+ sshType = sysType;
+ }
+ String connectionName = instance.getName() + " [" + instance.getId() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ IHost host = registry.createHost(sshType, connectionName, hostname, null);
+ if (host != null) {
+ host.setDefaultUserId("root"); //$NON-NLS-1$
+ IConnectorService[] services = host.getConnectorServices();
+ if (services.length > 0) {
+ final IConnectorService service = services[0];
+ Job connect = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG, connectionName)) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ service.connect(monitor);
+ return Status.OK_STATUS;
+ } catch(Exception e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ };
+ connect.setUser(true);
+ connect.schedule();
+ }
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
+ }
+ pm.done();
+ }
+ return Status.OK_STATUS;
+ }
+ else {
+ pm.done();
+ return Status.CANCEL_STATUS;
+ }
+ };
+ };
+
+ @Override
+ public boolean performFinish() {
+ String imageId = image.getId();
+ String profileId = mainPage.getHardwareProfile();
+ String realmId = mainPage.getRealmId();
+ String memory = mainPage.getMemoryProperty();
+ String storage = mainPage.getStorageProperty();
+ String keyname = mainPage.getKeyName();
+ String name = null;
+ try {
+ name = URLEncoder.encode(mainPage.getInstanceName(), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } //$NON-NLS-1$
+
+ boolean result = false;
+ String errorMessage = WizardMessages.getString(DEFAULT_REASON);
+ try {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ boolean dontShowDialog = prefs.getBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, false);
+ if (!dontShowDialog) {
+ MessageDialogWithToggle dialog =
+ MessageDialogWithToggle.openOkCancelConfirm(getShell(), WizardMessages.getString(CONFIRM_CREATE_TITLE),
+ WizardMessages.getString(CONFIRM_CREATE_MSG),
+ WizardMessages.getString(DONT_SHOW_THIS_AGAIN_MSG),
+ false, null, null);
+ int retCode = dialog.getReturnCode();
+ boolean toggleState = dialog.getToggleState();
+ if (retCode == Dialog.CANCEL)
+ return true;
+ // If warning turned off by user, set the preference for future usage
+ if (toggleState) {
+ prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE, true);
+ }
+ }
+ instance = cloud.createInstance(name, imageId, realmId, profileId, keyname, memory, storage);
+ if (instance != null)
+ result = true;
+ if (instance != null && instance.getState().equals(DeltaCloudInstance.PENDING)) {
+ final String instanceId = instance.getId();
+ final String instanceName = name;
+ Job job = new WatchCreateJob(WizardMessages.getString(STARTING_INSTANCE_TITLE),
+ cloud, instanceId, instanceName);
+ job.setUser(true);
+ job.schedule();
+ }
+ } catch (DeltaCloudException e) {
+ errorMessage = e.getLocalizedMessage();
+ }
+ if (!result) {
+ ErrorDialog.openError(this.getShell(),
+ WizardMessages.getString(CREATE_INSTANCE_FAILURE_TITLE),
+ WizardMessages.getFormattedString(CREATE_INSTANCE_FAILURE_MSG, new String[] {name, imageId, realmId, profileId}),
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, errorMessage));
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,401 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.osgi.service.prefs.Preferences;
+
+public class NewInstancePage extends WizardPage {
+
+ private final static String NAME = "NewInstance.name"; //$NON-NLS-1$
+ private final static String DESCRIPTION = "NewInstance.desc"; //$NON-NLS-1$
+ private final static String TITLE = "NewInstance.title"; //$NON-NLS-1$
+
+ private static final String NAME_LABEL = "Name.label"; //$NON-NLS-1$
+ private static final String IMAGE_LABEL = "Image.label"; //$NON-NLS-1$
+ private static final String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
+ private static final String HARDWARE_LABEL = "Profile.label"; //$NON-NLS-1$
+ private static final String REALM_LABEL = "Realm.label"; //$NON-NLS-1$
+ private static final String KEY_LABEL = "Key.label"; //$NON-NLS-1$
+ private static final String MANAGE_BUTTON_LABEL = "ManageButton.label"; //$NON-NLS-1$
+ private static final String PROPERTIES_LABEL = "Properties.label"; //$NON-NLS-1$
+
+ private static final String NONE_RESPONSE = "None.response"; //$NON-NLS-1$
+ @SuppressWarnings("unused")
+ private static final String NAME_ALREADY_IN_USE = "ErrorNameInUse.text"; //$NON-NLS-1$
+
+
+ private DeltaCloud cloud;
+ private DeltaCloudImage image;
+ private ArrayList<DeltaCloudHardwareProfile> profiles;
+
+ private Text nameText;
+ private Text keyText;
+ private Combo hardware;
+ private Button keyManage;
+ private Control realm;
+ private String[] profileIds;
+ private ProfileComposite currPage;
+ private ProfileComposite[] profilePages;
+ private ArrayList<String> realmIds;
+
+ private ModifyListener textListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ validate();
+ }
+ };
+
+ private ModifyListener comboListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ int index = hardware.getSelectionIndex();
+ currPage.setVisible(false);
+ currPage = profilePages[index];
+ currPage.setVisible(true);
+ }
+ };
+
+ private SelectionListener manageListener = new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ Shell shell = getShell();
+ ManageKeys wizard = new ManageKeys(cloud, ".pem"); //$NON-NLS-1$
+ WizardDialog dialog = new CustomWizardDialog(shell, wizard,
+ IDialogConstants.OK_LABEL);
+ dialog.create();
+ dialog.open();
+ String keyname = wizard.getKeyName();
+ if (keyname != null)
+ keyText.setText(keyname);
+ }
+
+ };
+
+ public NewInstancePage(DeltaCloud cloud, DeltaCloudImage image) {
+ super(WizardMessages.getString(NAME));
+ this.cloud = cloud;
+ this.image = image;
+ getPossibleProfiles();
+ setDescription(WizardMessages.getString(DESCRIPTION));
+ setTitle(WizardMessages.getString(TITLE));
+ setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
+ setPageComplete(false);
+ }
+
+ public String getHardwareProfile() {
+ return hardware.getText();
+ }
+
+ public String getRealmId() {
+ if (realm instanceof Combo) {
+ int index = ((Combo)realm).getSelectionIndex();
+ return realmIds.get(index);
+ } else {
+ return null;
+ }
+ }
+
+ public String getCpuProperty() {
+ return currPage.getCPU();
+ }
+
+ public String getStorageProperty() {
+ return currPage.getStorage();
+ }
+
+ public String getMemoryProperty() {
+ return currPage.getMemory();
+ }
+
+ public String getInstanceName() {
+ return nameText.getText();
+ }
+
+ public String getKeyName() {
+ return keyText.getText();
+ }
+
+ private void validate() {
+ boolean complete = true;
+ boolean errorFree = true;
+
+ setMessage(null);
+
+ String name = nameText.getText();
+ if (name.length() == 0) {
+ complete = false;
+ }
+
+ if (cloud.getType().equals(DeltaCloudInstance.EC2_TYPE)) {
+ String keyname = keyText.getText();
+ if (keyname.length() == 0)
+ complete = false;
+ else {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ try {
+ prefs.put(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME, keyname);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+
+ if (errorFree)
+ setErrorMessage(null);
+ setPageComplete(complete & errorFree);
+ }
+
+ private void getPossibleProfiles() {
+ profiles = new ArrayList<DeltaCloudHardwareProfile>();
+ DeltaCloudHardwareProfile[] allProfiles = cloud.getProfiles();
+ for (DeltaCloudHardwareProfile p : allProfiles) {
+ if (p.getArchitecture() == null || image.getArchitecture().equals(p.getArchitecture())) {
+ profiles.add(p);
+ }
+ }
+ }
+
+ private String[] getProfileIds(Composite container) {
+ String[] ids = new String[profiles.size()];
+ profilePages = new ProfileComposite[profiles.size()];
+ for (int i = 0; i < profiles.size(); ++i) {
+ DeltaCloudHardwareProfile p = profiles.get(i);
+ ids[i] = p.getId();
+ profilePages[i] = new ProfileComposite(p, container);
+ profilePages[i].setVisible(false);
+ }
+ currPage = profilePages[0];
+ return ids;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ final Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 5;
+ layout.marginWidth = 5;
+ container.setLayout(layout);
+
+ Label dummyLabel = new Label(container, SWT.NULL);
+
+ Label imageLabel = new Label(container, SWT.NULL);
+ imageLabel.setText(WizardMessages.getString(IMAGE_LABEL));
+
+ Label imageId = new Label(container, SWT.NULL);
+ imageId.setText(image.getName());
+
+ Label archLabel = new Label(container, SWT.NULL);
+ archLabel.setText(WizardMessages.getString(ARCH_LABEL));
+
+ Label arch = new Label(container, SWT.NULL);
+ arch.setText(image.getArchitecture());
+
+ Label nameLabel = new Label(container, SWT.NULL);
+ nameLabel.setText(WizardMessages.getString(NAME_LABEL));
+
+ Label realmLabel = new Label(container, SWT.NULL);
+ realmLabel.setText(WizardMessages.getString(REALM_LABEL));
+
+
+ nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ nameText.addModifyListener(textListener);
+
+
+ DeltaCloudRealm[] realms = cloud.getRealms();
+ realmIds = new ArrayList<String>();
+ ArrayList<String> realmNames = new ArrayList<String>();
+ for (int i = 0; i < realms.length; ++i) {
+ DeltaCloudRealm r = realms[i];
+ if (r.getState() == null || r.getState().equals(DeltaCloudRealm.AVAILABLE)) {
+ realmNames.add(r.getId() + " [" + r.getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ realmIds.add(r.getId());
+ }
+ }
+ if (realmIds.size() > 0) {
+ Combo combo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ combo.setItems(realmNames.toArray(new String[realmNames.size()]));
+ combo.setText(realmNames.get(0));
+ realm = combo;
+ } else {
+ Label label = new Label(container, SWT.NULL);
+ label.setText(WizardMessages.getString(NONE_RESPONSE));
+ realm = label;
+ }
+
+ Label hardwareLabel = new Label(container, SWT.NULL);
+ hardwareLabel.setText(WizardMessages.getString(HARDWARE_LABEL));
+
+ hardware = new Combo(container, SWT.READ_ONLY);
+ Group groupContainer = new Group(container, SWT.BORDER);
+ groupContainer.setText(WizardMessages.getString(PROPERTIES_LABEL));
+ FormLayout groupLayout = new FormLayout();
+ groupLayout.marginHeight = 0;
+ groupLayout.marginWidth = 0;
+ groupContainer.setLayout(groupLayout);
+
+
+ profileIds = getProfileIds(groupContainer);
+
+ if (profileIds.length > 0) {
+ hardware.setItems(profileIds);
+ hardware.setText(profileIds[0]);
+ profilePages[0].setVisible(true);
+ hardware.addModifyListener(comboListener);
+ }
+
+ Point p1 = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ dummyLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ nameLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(dummyLabel, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ nameText.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameText, 8);
+ f.left = new FormAttachment(0, 0);
+ imageLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(nameText, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ imageId.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageLabel, 8);
+ f.left = new FormAttachment(0, 0);
+ archLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(imageLabel, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ arch.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(arch, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ realmLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(arch, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ realm.setLayoutData(f);
+
+ Control control = realm;
+
+ if (cloud.getType().equals(DeltaCloudInstance.EC2_TYPE)) {
+ Label keyLabel = new Label(container, SWT.NULL);
+ keyLabel.setText(WizardMessages.getString(KEY_LABEL));
+
+ keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String defaultKeyname = prefs.get(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME, "");
+ keyText.setText(defaultKeyname);
+ keyText.addModifyListener(textListener);
+
+ keyManage = new Button(container, SWT.NULL);
+ keyManage.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
+ keyManage.addSelectionListener(manageListener);
+ Point p3 = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering2 = (p3.y - p2.y + 1) / 2;
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 8 + centering + centering2);
+ f.left = new FormAttachment(0, 0);
+ keyLabel.setLayoutData(f);
+
+ f = new FormData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.top = new FormAttachment(realm, 8);
+ f.right = new FormAttachment(realm, 0, SWT.RIGHT);
+ keyManage.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 8 + centering2);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(keyManage, -10);
+ keyText.setLayoutData(f);
+
+ control = keyText;
+ }
+
+ f = new FormData();
+ f.top = new FormAttachment(control, 8 + centering);
+ f.left = new FormAttachment(0, 0);
+ hardwareLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(control, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(100, 0);
+ hardware.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(hardware, 10);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(100, 0);
+ groupContainer.setLayoutData(f);
+
+ setControl(container);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,391 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Spinner;
+import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
+import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProperty;
+
+public class ProfileComposite {
+
+ private static final String CPU_LABEL = "Cpu.label"; //$NON-NLS-1$
+ private static final String MEMORY_LABEL = "Memory.label"; //$NON-NLS-1$
+ private static final String STORAGE_LABEL = "Storage.label"; //$NON-NLS-1$
+ private static final String DEFAULTED = "Defaulted"; //$NON-NLS-1$
+
+ private Composite container;
+ private DeltaCloudHardwareProfile profile;
+ private String cpu;
+ private String cpuDefaultValue;
+ private Label cpuLabel;
+ private Spinner cpuSpinner;
+ private Combo cpuCombo;
+ private String memory;
+ private String memoryDefaultValue;
+ private Label memoryLabel;
+ private Spinner memorySpinner;
+ private Combo memoryCombo;
+ private int memoryDecDigits;
+ private String storage;
+ private String storageDefaultValue;
+ private Label storageLabel;
+ private Spinner storageSpinner;
+ private Combo storageCombo;
+ private int storageDecDigits;
+
+ private int cw = 160;
+
+ private ModifyListener spinnerListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ String value = ((Spinner)e.widget).getText();
+ if (e.widget == cpuSpinner)
+ cpu = value;
+ else if (e.widget == memorySpinner)
+ memory = value;
+ else if (e.widget == storageSpinner)
+ storage = value;
+ }
+ };
+
+
+ private ModifyListener comboListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ String value = ((Combo)e.widget).getText();
+ if (e.widget == cpuCombo)
+ cpu = value;
+ else if (e.widget == memoryCombo)
+ memory = value;
+ else if (e.widget == storageCombo)
+ storage = value;
+ }
+
+ };
+
+ public ProfileComposite(DeltaCloudHardwareProfile p, Composite parent) {
+ this.profile = p;
+ container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ container.setLayout(layout);
+ Control cpuControl = null;
+ Control memoryControl = null;
+ Control storageControl = null;
+
+ cpuLabel = new Label(container, SWT.NULL);
+ cpuLabel.setText(WizardMessages.getString(CPU_LABEL));
+
+ memoryLabel = new Label(container, SWT.NULL);
+ memoryLabel.setText(WizardMessages.getString(MEMORY_LABEL));
+
+ storageLabel = new Label(container, SWT.NULL);
+ storageLabel.setText(WizardMessages.getString(STORAGE_LABEL));
+
+ DeltaCloudHardwareProperty cpuProperty = profile.getNamedProperty("cpu"); //$NON-NLS-1$
+ FormData fd = new FormData();
+ fd.left = new FormAttachment(0, 0);
+ fd.top = new FormAttachment(0, 0);
+ cpuLabel.setLayoutData(fd);
+ if (cpuProperty != null) {
+ if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
+ Label cpu = new Label(container, SWT.NULL);
+ cpu.setText(cpuProperty.getValue());
+ FormData f = new FormData();
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(100, 0);
+ cpu.setLayoutData(f);
+ cpuControl = cpu;
+ } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
+ cpuDefaultValue = cpuProperty.getValue();
+ cpuSpinner = new Spinner(container, SWT.READ_ONLY);
+ cpuSpinner.setMinimum(Integer.valueOf(cpuProperty.getRange().getFirst()));
+ cpuSpinner.setMaximum(Integer.valueOf(cpuProperty.getRange().getLast()));
+ cpuSpinner.addModifyListener(spinnerListener);
+ cpuSpinner.setSelection(Integer.valueOf(cpuDefaultValue));
+ FormData f = new FormData();
+ f.width = 80;
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ cpuSpinner.setLayoutData(f);
+ cpuControl = cpuSpinner;
+ } else if (cpuProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
+ cpuDefaultValue = cpuProperty.getValue();
+ List<String> values = cpuProperty.getEnums();
+ cpuCombo = new Combo(container, SWT.BORDER);
+ String[] items = new String[values.size()];
+ cpuCombo.setItems(values.toArray(items));
+ cpuCombo.setText(items[0]);
+ cpuCombo.addModifyListener(comboListener);
+ FormData f = new FormData();
+ f.width = 80;
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ cpuCombo.setLayoutData(f);
+ cpuControl = cpuCombo;
+ }
+ String cpuUnit = cpuProperty.getUnit();
+ if (cpuUnit != null && !cpuUnit.equals("label") && !cpuUnit.equals("count")) { //$NON-NLS-1$ //$NON-NLS-1$
+ Label unitLabel = new Label(container, SWT.NULL);
+ unitLabel.setText(cpuProperty.getUnit());
+ FormData f = new FormData();
+ f.left = new FormAttachment(cpuControl, 5);
+ unitLabel.setLayoutData(f);
+ }
+ } else {
+ Label cpu = new Label(container, SWT.NULL);
+ cpu.setText(WizardMessages.getString(DEFAULTED));
+ FormData f = new FormData();
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(100, 0);
+ cpu.setLayoutData(f);
+ cpuControl = cpu;
+ }
+ DeltaCloudHardwareProperty memoryProperty = profile.getNamedProperty("memory"); //$NON-NLS-1$
+ fd = new FormData();
+ fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
+ fd.top = new FormAttachment(cpuLabel, 8);
+ memoryLabel.setLayoutData(fd);
+ if (memoryProperty != null) {
+ if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
+ Label memory = new Label(container, SWT.NULL);
+ memory.setText(memoryProperty.getValue());
+ FormData f = new FormData();
+ f.top = new FormAttachment(cpuControl, 8);
+ f.left = new FormAttachment(storageLabel, 50);
+ memory.setLayoutData(f);
+ memoryControl = memory;
+ } else if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
+ memoryDefaultValue = memoryProperty.getValue();
+ int indexDefault = memoryDefaultValue.indexOf('.');
+ int decDigitsDefault = 0;
+ if (indexDefault >= 0) {
+ decDigitsDefault = memoryDefaultValue.length() - indexDefault - 1;
+ memoryDefaultValue = memoryDefaultValue.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ memorySpinner = new Spinner(container, SWT.READ_ONLY | SWT.BORDER);
+ String first = memoryProperty.getRange().getFirst();
+ int indexFirst = first.indexOf('.');
+ int decDigitsFirst = 0;
+ if (indexFirst >= 0) {
+ decDigitsFirst = first.length() - indexFirst - 1;
+ first = first.replace(".", ""); //$NON-NLS-1$ $NON-NLS-2$
+ }
+ String last = memoryProperty.getRange().getLast();
+ int indexLast = first.indexOf('.');
+ int decDigitsLast = 0;
+ if (indexLast >= 0) {
+ decDigitsLast = last.length() - indexLast - 1;
+ last = last.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ int decDigits = Math.max(decDigitsFirst, decDigitsLast);
+ memoryDecDigits = Math.max(decDigits, decDigitsDefault);
+ if (decDigitsFirst < memoryDecDigits) {
+ for (int i= 0; i < memoryDecDigits - decDigitsFirst; ++i)
+ first = first.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsLast < memoryDecDigits) {
+ for (int i = 0; i < memoryDecDigits - decDigitsLast; ++i)
+ last = last.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsDefault < memoryDecDigits) {
+ for (int i = 0; i < memoryDecDigits - decDigitsLast; ++i)
+ memoryDefaultValue = memoryDefaultValue.concat("0"); //$NON-NLS-1$
+ }
+ memorySpinner.setMinimum(Integer.valueOf(first));
+ memorySpinner.setMaximum(Integer.valueOf(last));
+ memorySpinner.setDigits(memoryDecDigits);
+ memorySpinner.addModifyListener(spinnerListener);
+ memorySpinner.setSelection(Integer.valueOf(memoryDefaultValue));
+ FormData f = new FormData();
+ f.width = 80;
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ f.top = new FormAttachment(cpuControl, 5);
+ memorySpinner.setLayoutData(f);
+ memoryControl = memorySpinner;
+ } else if (memoryProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
+ memoryDefaultValue = memoryProperty.getValue();
+ List<String> values = memoryProperty.getEnums();
+ memoryCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ String[] items = new String[values.size()];
+ memoryCombo.setItems(values.toArray(items));
+ memoryCombo.setText(items[0]);
+ memoryCombo.addModifyListener(comboListener);
+ FormData f = new FormData();
+ f.width = 80;
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ f.top = new FormAttachment(cpuControl, 5);
+ memoryCombo.setLayoutData(f);
+ memoryControl = memoryCombo;
+ }
+ String memoryUnit = memoryProperty.getUnit();
+ if (memoryUnit != null && !memoryUnit.equals("label")) { //$NON-NLS-1$
+ Label unitLabel = new Label(container, SWT.NULL);
+ unitLabel.setText(memoryUnit);
+ FormData f = new FormData();
+ f.left = new FormAttachment(memoryControl, 3);
+ f.top = new FormAttachment(cpuControl, 8);
+ unitLabel.setLayoutData(f);
+ }
+ } else {
+ Label memory = new Label(container, SWT.NULL);
+ memory.setText(WizardMessages.getString(DEFAULTED));
+ FormData f = new FormData();
+ f.top = new FormAttachment(cpuControl, 8);
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(100, 0);
+ memory.setLayoutData(f);
+ memoryControl = memory;
+ }
+ DeltaCloudHardwareProperty storageProperty = profile.getNamedProperty("storage"); //$NON-NLS-1$
+ fd = new FormData();
+ fd.left = new FormAttachment(cpuLabel, 0, SWT.LEFT);
+ fd.top = new FormAttachment(memoryControl, 8);
+ storageLabel.setLayoutData(fd);
+ if (storageProperty != null) {
+ if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.FIXED) {
+ Label storage = new Label(container, SWT.NULL);
+ storage.setText(storageProperty.getValue());
+ FormData f = new FormData();
+ f.left = new FormAttachment(storageLabel, 50);
+ f.top = new FormAttachment(memoryControl, 8);
+ storage.setLayoutData(f);
+ storage.setVisible(true);
+ storageControl = storage;
+ } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.RANGE) {
+ storageDefaultValue = storageProperty.getValue();
+ int indexDefault = storageDefaultValue.indexOf('.');
+ int decDigitsDefault = 0;
+ if (indexDefault >= 0) {
+ decDigitsDefault = storageDefaultValue.length() - indexDefault - 1;
+ storageDefaultValue = storageDefaultValue.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ Spinner storageSpinner = new Spinner(container, SWT.READ_ONLY | SWT.BORDER);
+ String first = memoryProperty.getRange().getFirst();
+ int indexFirst = first.indexOf('.');
+ int decDigitsFirst = 0;
+ if (indexFirst >= 0) {
+ decDigitsFirst = first.length() - indexFirst - 1;
+ first = first.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ String last = memoryProperty.getRange().getLast();
+ int indexLast = first.indexOf('.');
+ int decDigitsLast = 0;
+ if (indexLast >= 0) {
+ decDigitsLast = last.length() - indexLast - 1;
+ last = last.replace(".", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ int decDigits = Math.max(decDigitsFirst, decDigitsLast);
+ storageDecDigits = Math.max(decDigits, decDigitsDefault);
+ if (decDigitsFirst < storageDecDigits) {
+ for (int i= 0; i < storageDecDigits - decDigitsFirst; ++i)
+ first = first.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsLast < storageDecDigits) {
+ for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
+ last = last.concat("0"); //$NON-NLS-1$
+ }
+ if (decDigitsDefault < storageDecDigits) {
+ for (int i = 0; i < storageDecDigits - decDigitsLast; ++i)
+ storageDefaultValue = storageDefaultValue.concat("0"); //$NON-NLS-1$
+ }
+ storageSpinner.setMinimum(Integer.valueOf(first));
+ storageSpinner.setMaximum(Integer.valueOf(last));
+ storageSpinner.setDigits(storageDecDigits);
+ storageSpinner.addModifyListener(spinnerListener);
+ storageSpinner.setSelection(Integer.valueOf(storageDefaultValue));
+ FormData f = new FormData();
+ f.width = 80;
+ f.top = new FormAttachment(memoryControl, 5);
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ storageSpinner.setLayoutData(f);
+ storageControl = storageSpinner;
+ } else if (storageProperty.getKind() == DeltaCloudHardwareProperty.Kind.ENUM) {
+ storageDefaultValue = storageProperty.getValue();
+ List<String> values = storageProperty.getEnums();
+ storageCombo = new Combo(container, SWT.BORDER | SWT.READ_ONLY);
+ String[] items = new String[values.size()];
+ storageCombo.setItems(values.toArray(items));
+ storageCombo.setText(items[0]);
+ storageCombo.addModifyListener(comboListener);
+ FormData f = new FormData();
+ f.width = 80;
+ f.left = new FormAttachment(storageLabel, 50);
+ f.right = new FormAttachment(storageLabel, cw, SWT.RIGHT);
+ f.top = new FormAttachment(memoryControl, 5);
+ storageCombo.setLayoutData(f);
+ storageControl = storageCombo;
+ }
+ String storageUnit = storageProperty.getUnit();
+ if (storageUnit != null && !storageUnit.equals("label")) { //$NON-NLS-1$
+ Label unitLabel = new Label(container, SWT.NULL);
+ unitLabel.setText(storageUnit);
+ FormData f = new FormData();
+ f.left = new FormAttachment(storageControl, 3);
+ f.top = new FormAttachment(memoryControl, 8);
+ unitLabel.setLayoutData(f);
+ }
+
+ } else {
+ Label storage = new Label(container, SWT.NULL);
+ storage.setText(WizardMessages.getString(DEFAULTED));
+ FormData f = new FormData();
+ f.left = new FormAttachment(storageLabel, 50);
+ f.top = new FormAttachment(memoryControl, 8);
+ f.right = new FormAttachment(100, 0);
+ storage.setLayoutData(f);
+ storage.setVisible(true);
+ storageControl = storage;
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ container.setVisible(visible);
+ }
+
+ public String getCPU() {
+ if (cpu != null && !cpu.equals(cpuDefaultValue))
+ return cpu;
+ return null;
+ }
+
+ public String getMemory() {
+ if (memory != null && !memory.equals(memoryDefaultValue)) {
+ return memory;
+ }
+ return null;
+ }
+
+ public String getStorage() {
+ if (storage != null && !storage.equals(storageDefaultValue)) {
+ return storage;
+ }
+ return null;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class WizardMessages {
+
+ private static final String BUNDLE_NAME = WizardMessages.class.getName();
+
+ public static String getString(String key) {
+ try {
+ return ResourceBundle.getBundle(BUNDLE_NAME).getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ } catch (NullPointerException e) {
+ return '#' + key + '#';
+ }
+ }
+
+ public static String getFormattedString(String key, String arg) {
+ return MessageFormat.format(getString(key), new Object[] { arg });
+ }
+
+ public static String getFormattedString(String key, String[] args) {
+ return MessageFormat.format(getString(key), (Object[])args);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-10-13 16:53:57 UTC (rev 25801)
@@ -0,0 +1,105 @@
+#################################################################################
+# Copyright (c) 2010 Red Hat, Inc.
+# 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:
+# Red Hat Incorporated - initial API and implementation
+#################################################################################
+NewCloudConnection.desc=Specify connection details for a cloud you wish to access
+NewCloudConnection.title=Cloud Connection
+NewCloudConnection.name=Cloud Connection
+NewCloudConnectionTest.success=Connection Test successful
+NewCloudConnectionTest.failure=Connection Test failed
+
+EditCloudConnection.name=Edit Cloud Connection
+
+Url.label=URL:
+Name.label=Name:
+Type.label=Type:
+UserName.label=Username:
+Password.label=Password:
+TestButton.label=Test
+UnknownType.label=Unknown
+Id.label=ID:
+ImageId.label=Image ID:
+OwnerId.label=Owner ID:
+Image.label=Image:
+Arch.label=Architecture:
+Desc.label=Description:
+Profile.label=Hardware Profile:
+Properties.label=Profile Properties
+Cpu.label=CPUs:
+Memory.label=Memory:
+Realm.label=Realm:
+Storage.label=Storage:
+Key.label=Key Name:
+BrowseButton.label=Browse...
+ManageButton.label=Manage...
+NewButton.label=New...
+DeleteButton.label=Delete
+DefaultButton.label=Default
+
+Pem.name=PEM file (*.pem)
+
+BackGround.label=Run In Background
+AlwaysRunInBackground.msg=Always run in the background
+Progress.msg=Progress
+
+None.response=None
+Defaulted=Defaulted
+
+CreateInstanceError.title=Launch Instance Failure
+CreateInstanceError.msg=The attempt to launch instance: name={0}, image={1}, realm={2}, profile={3}
+CreateInstanceErrorReason.msg=Server did not launch instance
+
+ConfirmCreate.title=Confirm Launch Instance
+ConfirmCreate.msg=Launching an instance may result in financial charges. Do you wish to continue?
+DontShowThisAgain.msg=Don't show this dialog again
+
+EC2UserNameLink.text=For EC2 use the <a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8...">Access ID</a>
+EC2PasswordLink.text=For EC2 use the <a href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8...">Access Secret Key</a>
+
+ErrorNameInUse.text=Error: the name chosen is already in use
+ErrorMustNameConnection.text=You must name the connection
+ErrorMustProvideUrl.text=You must provide an url for the cloud
+ErrorCouldNotOpenBrowser.text=Could not open url \"{0}\"in Browser
+ErrorInvalidURL.text=URL specified is invalid
+ErrorNonCloudURL.text=URL specified is not a valid Delta-cloud address
+ErrorInvalidPem.text=File specified is not a valid existing key
+
+NewInstance.desc=Specify details for a new instance you wish to launch based on an image
+NewInstance.title=Launch Instance
+NewInstance.name=Launch Instance
+
+ManageKeys.desc=Select a physical key to use when creating an instance so that it may be accessed remotely.
+ManageKeys.title=Manage Keys
+ManageKeys.name=Manage Keys
+
+ImageFilter.desc=Specify rules to determine which Images will appear in the dialog.
+ImageFilter.title=Image Filter
+ImageFilter.name=Image Filter
+
+ImageFilter.label=Show all images which match the following rules (* \= wildcard)\:
+ErrorFilterEmptyRule.msg=Rules cannot be empty strings
+ErrorFilterSemicolon.msg=Rules cannot contain a semi-colon character
+ErrorFieldError.msg={0} {1}
+
+InstanceFilter.desc=Specify rules to determine which Instances will appear in the dialog.
+InstanceFilter.title=Instance Filter
+InstanceFilter.name=Instance Filter
+InstanceFilter.label=Show all instances which match the following rules (* \= wildcard)\:
+
+ErrorInvalidDirectory.text=Specified directory is not a valid existing directory
+Directory.label=Directory
+
+CreateKey.title=Create Key
+CreateKey.msg=Specify a unique name for a new key:
+ConfirmKeyDelete.title=Confirm Key Delete
+ConfirmKeyDelete.msg=Confirm deletion of key: {0}
+
+StartingInstance.title=Starting Instance
+StartingInstance.msg=Starting Instance: {0}
+ConnectingRSE.msg=Connecting instance as: {0}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 3 months
JBoss Tools SVN: r25798 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-10-13 12:30:11 -0400 (Wed, 13 Oct 2010)
New Revision: 25798
Modified:
trunk/build/target-platform/build.xml
Log:
install.local.target.platform.repo should depend on init step for bootstrapping ant-contrib and default paths
Modified: trunk/build/target-platform/build.xml
===================================================================
--- trunk/build/target-platform/build.xml 2010-10-13 16:04:31 UTC (rev 25797)
+++ trunk/build/target-platform/build.xml 2010-10-13 16:30:11 UTC (rev 25798)
@@ -162,7 +162,7 @@
</exec>
</target>
- <target name="install.local.target.platform.repo" description="use p2.director to install target platform into local eclipse">
+ <target name="install.local.target.platform.repo" depends="init" description="use p2.director to install target platform into local eclipse">
<!-- collect features to install -->
<var name="install" value="" />
<for param="featureJar">
14 years, 3 months
JBoss Tools SVN: r25797 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-10-13 12:04:31 -0400 (Wed, 13 Oct 2010)
New Revision: 25797
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
Log:
https://jira.jboss.org/browse/JBIDE-7263 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-10-13 16:00:16 UTC (rev 25796)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-10-13 16:04:31 UTC (rev 25797)
@@ -384,11 +384,11 @@
// String dialect =
// "org.hibernate.dialect.HSQLDialect";//cpProperties.getProperty("org.eclipse.datatools.connectivity.db.driverClass");
// invoke.setProperty(Environment.DIALECT, dialect);
- String driverClass = driverInstance.getProperty("org.eclipse.datatools.connectivity.db.driverClass"); //$NON-NLS-1$
+ String driverClass = driverInstance != null ?
+ driverInstance.getProperty("org.eclipse.datatools.connectivity.db.driverClass") : ""; //$NON-NLS-1$ //$NON-NLS-2$
localCfg.setProperty(Environment.DRIVER, driverClass);
- // TODO:
- @SuppressWarnings("unused")
- String driverJarPath = driverInstance.getJarList();
+ //String driverJarPath = driverInstance != null ?
+ // driverInstance.getJarList() : ""; //$NON-NLS-1$
String url = cpProperties.getProperty("org.eclipse.datatools.connectivity.db.URL"); //$NON-NLS-1$
// url += "/";// +
// cpProperties.getProperty("org.eclipse.datatools.connectivity.db.databaseName");
14 years, 3 months
JBoss Tools SVN: r25796 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-13 12:00:16 -0400 (Wed, 13 Oct 2010)
New Revision: 25796
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
Log:
[JBIDE-7329] removed unneeded string keys and language entries
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-10-13 15:55:57 UTC (rev 25795)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-10-13 16:00:16 UTC (rev 25796)
@@ -30,9 +30,6 @@
CloudSelector.label=Select Cloud:
-NewConnection.label=New Cloud Connection
-RemoveCloud.label=Disconnect Cloud
-EditCloud.label=Edit Connection
Refresh.label=Refresh Cloud
Filter.label=Filter...
Filtered.label=filtered
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 15:55:57 UTC (rev 25795)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 16:00:16 UTC (rev 25796)
@@ -60,9 +60,6 @@
*/
public static final String ID = "org.jboss.tools.deltacloud.ui.views.DeltaCloudView";
- private static final String NEW_CONNECTION = "NewConnection.label"; //$NON-NLS-1$
- private static final String REMOVE_CLOUD = "RemoveCloud.label"; //$NON-NLS-1$
- private static final String EDIT_CLOUD = "EditCloud.label"; //$NON-NLS-1$
private static final String REFRESH = "Refresh.label"; //$NON-NLS-1$
private static final String CREATE_INSTANCE = "CreateInstance.label"; //$NON-NLS-1$
private final static String START_LABEL = "Start.label"; //$NON-NLS-1$
14 years, 3 months
JBoss Tools SVN: r25795 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: META-INF and 13 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-13 11:55:57 -0400 (Wed, 13 Oct 2010)
New Revision: 25795
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/DataBindingUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/MaxSeverityValidationStatusProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/swt/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/UIUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/CompositeValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/MandatoryStringValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/swt/JFaceUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CustomWizardDialog.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/EditCloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilterPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeys.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeysPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewCloudConnection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstance.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstancePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ProfileComposite.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/WizardMessages.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
Log:
[JBIDE-7329] corrected package structure (internal was in the wrong place), replaced connection related actions by handlers, hooked delete connectoin to the global delete action
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/>
-<booleanAttribute key="askclear" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
-<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Deltacloud Tools"/>
<booleanAttribute key="default" value="false"/>
@@ -23,13 +23,13 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx1024m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.console@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.ecf.filetransfer@default:default,org.hamcrest.core@default:default,org.eclipse.help.webapp@default:default,org.eclipse.wst.validation@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.http.jetty@default:default,org.apache.xerces@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.compare.core@default:default,com.ibm.icu@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.core.databinding@default:default,org.eclipse.help.appserver@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.p2.core@default:defau!
lt,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.jboss.tools.common@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.rse.services@default:default,org.eclipse.ui.ide@default:default,org.eclipse.equinox.app@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.core.runtime.compatibility@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.apache.commons.el@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.ui.views@default:default,org.apach!
e.xml.serializer@default:default,org.eclipse.rse.core@default:!
default,
org.eclipse.jdt.compiler.tool@default:false,org.eclipse.text@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.core.resources@default:default,org.apache.jasper@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.update.configurator@3:true,org.eclipse.osgi.util@default:default,javax.servlet@default:default,org.eclipse.debug.ui@default:default,org.eclipse.ecf@default:default,org.eclipse.team.core@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.emf.ecore@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.core.jobs@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.jdt.core.manipulation@default:default,org.apache.xml.resolver@default:default,org.eclipse.help@default:default,org.eclipse.jdt.ui!
@default:default,org.eclipse.jem.util@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.core.commands@default:default,javax.servlet.jsp@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.common@default:default,org.eclipse.search@default:default,org.eclipse.jface.text@default:default,org.eclipse.team.ui@default:default,org.eclipse.ant.core@default:default,org.eclipse.ui@default:default,org.eclipse.ui.editors@default:default,org.apache.ant@default:default,org.eclipse.equinox.p2.engine@default:default,org.apache.lucene@default:default,org.eclipse.jface@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.core.databinding.observable@default:default,org.eclipse.ecf.identity@default:default,org.jbos!
s.tools.xulrunner.initializer@default:false,org.eclipse.emf.ec!
ore.chan
ge@default:default,org.eclipse.compare@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.equinox.preferences@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.osgi@-1:true,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.jdt.core@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.help.ui@default:default,org.mortbay.jetty.util@default:default,org.eclipse.osgi.services@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.variables@default:default,org.eclipse.core.contenttype@default:default,org.mortbay.jetty.server@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.core.net@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.p2.metadata.repo!
sitory@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.runtime@default:true,org.apache.lucene.analysis@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.ui.navigator.resources@default:default,org.junit4@default:default,javax.xml@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.eclipse.sdk@default:default,org.eclipse.help.base@default:default,org.eclipse.swt@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.ui.navigator@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.deltacloud.ui@default:default,org.jboss.tools.usage@default:default,org.jboss.tools.deltacloud.docs@default:default,org.jboss.tools.deltacloud.core@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.help.webapp@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.wst.validation@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.equinox.p2.engine@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.jface@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.apache.lucene@default:default,org.eclipse.wst.common.environment@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.mortbay.jetty.util@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.equinox.common@2:true,org.eclipse.compare@default:default,org.e!
clipse.ecf.provider.filetransfer@default:default,org.eclipse.ui.console@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.equinox.http.servlet@default:default,org.eclipse.jface.text@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.team.core@default:default,org.eclipse.help@default:default,org.eclipse.swt@default:default,org.mortbay.jetty.server@default:default,org.eclipse.core.jobs@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.ant.core@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.apache.xml.serializer@default:default,org.eclipse.ui.cheatsheets@def!
ault:default,org.eclipse.debug.core@default:default,org.eclips!
e.wst.xm
l.core@default:default,org.eclipse.jdt.ui@default:default,org.apache.xml.resolver@default:default,org.jboss.tools.common@default:default,org.eclipse.wst.common.emf@default:default,org.junit4@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.jem.util@default:default,org.apache.ant@default:default,org.eclipse.osgi.services@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.apache.lucene.analysis@default:default,org.eclipse.help.appserver@default:default,org.eclipse.core.net@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.rse.services@default:default,org.eclipse.core.resources@default:default,org.eclipse.ui@default:default,org.eclipse.emf.common@default:default,javax.servlet.jsp@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.equinox.p2.metadata.repository@default:default,org.ecl!
ipse.debug.ui@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.help.base@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.editors@default:default,org.eclipse.sdk@default:default,org.eclipse.ui.forms@default:default,org.eclipse.compare.core@default:default,javax.xml@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.jdt.core@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.text@default:default,org.eclipse.osgi.util@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.osgi@-1:true,org.eclipse.core.databinding@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.ui.ide@default:default,org.apache.jasper@!
default:default,org.eclipse.search@default:default,org.apache.!
commons.
el@default:default,javax.servlet@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.variables@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.rse.core@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.emf.edit@default:default,org.hamcrest.core@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.jsp.jasper.r!
egistry@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.help.ui@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.core.commands@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.core.expressions@default:default,org.eclipse.ecf.identity@default:default,com.ibm.icu@default:default,org.eclipse.jface.databinding@default:default,org.apache.xerces@default:default,org.eclipse.ecf@default:default,org.eclipse.equinox.security.ui@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.deltacloud.docs@default:default,org.jboss.tools.usage@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.deltacloud.ui@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
-<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
<booleanAttribute key="useProduct" value="true"/>
</launchConfiguration>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-13 15:55:57 UTC (rev 25795)
@@ -13,11 +13,11 @@
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0",
org.jboss.tools.deltacloud.core;bundle-version="0.0.1",
org.eclipse.rse.core;bundle-version="3.1.1",
- org.eclipse.jface.databinding;bundle-version="1.4.0",
- org.eclipse.core.databinding;bundle-version="1.3.100",
- org.eclipse.core.databinding.observable;bundle-version="1.3.0",
- org.eclipse.core.databinding.property;bundle-version="1.3.0",
+ org.eclipse.jface.databinding;bundle-version="[1.4.0,2.0.0)",
+ org.eclipse.core.databinding;bundle-version="[1.3.100,2.0.0)",
+ org.eclipse.core.databinding.observable;bundle-version="[1.3.0,2.0.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
- org.jboss.tools.common;bundle-version="3.2.0"
+ org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-13 15:55:57 UTC (rev 25795)
@@ -79,7 +79,7 @@
</category>
<wizard
category="org.jboss.tools.deltacloud.ui.wizard.category"
- class="org.jboss.tools.internal.deltacloud.ui.wizards.NewCloudConnection"
+ class="org.jboss.tools.deltacloud.ui.internal.wizards.NewCloudConnection"
icon="icons/delta.gif"
id="org.jboss.tools.deltacloud.ui.connection.wizard"
name="%NewWizard.name">
@@ -102,5 +102,74 @@
name="%Preferences.name">
</page>
</extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.NewConnectionHandler"
+ commandId="org.jboss.tools.deltacloud.ui.newconnection">
+ </handler>
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.EditConnectionHandler"
+ commandId="org.jboss.tools.deltacloud.ui.editconnection">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ <handler
+ class="org.jboss.tools.deltacloud.ui.commands.DisconnectCloudHandler"
+ commandId="org.eclipse.ui.edit.delete">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <iterate>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </instanceof>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.jboss.tools.deltacloud.menus.cloudviewer">
+ <command
+ commandId="org.eclipse.ui.edit.delete"
+ label="Disconnect Cloud"
+ style="push">
+ </command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.newconnection"
+ label="New Connection"
+ style="push">
+ </command>
+ <command
+ commandId="org.jboss.tools.deltacloud.ui.editconnection"
+ label="Edit Connection"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Creates a new cloud connection"
+ id="org.jboss.tools.deltacloud.ui.newconnection"
+ name="New Connection">
+ </command>
+ <command
+ id="org.jboss.tools.deltacloud.ui.editconnection"
+ name="Edit Connection">
+ </command>
+ </extension>
</plugin>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.commands;
+
+import javax.net.ssl.SSLEngineResult.Status;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.DisconnectCloudsDialog;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class DisconnectCloudHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ DisconnectCloudsDialog dialog = new DisconnectCloudsDialog(
+ shell
+ , ((IStructuredSelection) selection).toList());
+ if (Dialog.OK == dialog.open()) {
+ removeCloudViewElements(dialog.getResult());
+ }
+ }
+
+ return Status.OK;
+ }
+
+ private void removeCloudViewElements(Object[] cloudViewerElements) {
+ for (Object cloudViewElement : cloudViewerElements) {
+ if (cloudViewElement instanceof CloudViewElement) {
+ DeltaCloud deltaCloud = (DeltaCloud) ((CloudViewElement) cloudViewElement).getElement();
+ DeltaCloudManager.getDefault().removeCloud(deltaCloud);
+ }
+ }
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.internal.utils.UIUtils;
+import org.jboss.tools.deltacloud.ui.internal.wizards.EditCloudConnection;
+import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class EditConnectionHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ CloudViewElement element = UIUtils.getFirstElement(selection, CloudViewElement.class);
+ while (element != null && !(element instanceof CVCloudElement)) {
+ element = (CloudViewElement) element.getParent();
+ }
+ if (element != null) {
+ CVCloudElement cloudElement = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ IWizard wizard = new EditCloudConnection(cloud);
+ WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,38 @@
+package org.jboss.tools.deltacloud.ui.commands;
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.deltacloud.ui.internal.wizards.NewCloudConnection;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class NewConnectionHandler extends AbstractHandler implements IHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ NewCloudConnection wizard = new NewCloudConnection();
+ wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ wizard);
+ dialog.create();
+ dialog.open();
+
+ return Status.OK_STATUS;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.deltacloud.ui.common.databinding;
-
-
-import java.util.Collection;
-
-import org.eclipse.core.databinding.Binding;
-
-public class DataBindingUtils
-{
- private DataBindingUtils()
- {
- }
-
- /**
- * Disposes all bindings in a given collection an clears the collection.
- *
- * @param bindingCollection the binding collection
- *
- * @return the collection<binding>
- */
- public static Collection<Binding> disposeBindings( Collection<Binding> bindingCollection )
- {
- if ( bindingCollection != null )
- {
- for ( Binding binding : bindingCollection )
- {
- binding.dispose();
- }
- bindingCollection.clear();
- }
- return bindingCollection;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,40 +0,0 @@
-package org.jboss.tools.deltacloud.ui.common.databinding;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.ValidationStatusProvider;
-import org.eclipse.core.databinding.observable.value.ComputedValue;
-import org.eclipse.core.runtime.IStatus;
-
-public class MaxSeverityValidationStatusProvider extends ComputedValue {
-
- private Collection validationStatusProviders;
-
- public MaxSeverityValidationStatusProvider(DataBindingContext dbc) {
- super(ValidationStatusProvider.class);
- this.validationStatusProviders = dbc.getValidationStatusProviders();
- }
-
- protected Object calculate() {
- int maxSeverity = IStatus.OK;
- ValidationStatusProvider maxSeverityProvider = null;
- for (Iterator it = validationStatusProviders.iterator(); it.hasNext();) {
- ValidationStatusProvider provider = (ValidationStatusProvider) it
- .next();
- IStatus status = (IStatus) provider.getValidationStatus()
- .getValue();
- if (status.getSeverity() > maxSeverity) {
- maxSeverity = status.getSeverity();
- maxSeverityProvider = provider;
- }
- }
- return maxSeverityProvider;
- }
-
- public synchronized void dispose() {
- validationStatusProviders = null;
- super.dispose();
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.common.databinding;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-/**
- * A POJO base class that may notify observers on behalf of
- * {@link PropertyChangeSupport}
- */
-public abstract class ObservablePojo {
-
- private PropertyChangeSupport propertyChangeSupport;
-
- public ObservablePojo() {
- this.propertyChangeSupport = new PropertyChangeSupport(this);
- }
-
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
- }
-
- protected PropertyChangeSupport getPropertyChangeSupport() {
- return propertyChangeSupport;
- }
-}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/DataBindingUtils.java (from rev 25789, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/DataBindingUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/DataBindingUtils.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.deltacloud.ui.internal.common.databinding;
+
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.Binding;
+
+public class DataBindingUtils
+{
+ private DataBindingUtils()
+ {
+ }
+
+ /**
+ * Disposes all bindings in a given collection an clears the collection.
+ *
+ * @param bindingCollection the binding collection
+ *
+ * @return the collection<binding>
+ */
+ public static Collection<Binding> disposeBindings( Collection<Binding> bindingCollection )
+ {
+ if ( bindingCollection != null )
+ {
+ for ( Binding binding : bindingCollection )
+ {
+ binding.dispose();
+ }
+ bindingCollection.clear();
+ }
+ return bindingCollection;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/DataBindingUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/MaxSeverityValidationStatusProvider.java (from rev 25789, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/MaxSeverityValidationStatusProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/MaxSeverityValidationStatusProvider.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,40 @@
+package org.jboss.tools.deltacloud.ui.internal.common.databinding;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.ValidationStatusProvider;
+import org.eclipse.core.databinding.observable.value.ComputedValue;
+import org.eclipse.core.runtime.IStatus;
+
+public class MaxSeverityValidationStatusProvider extends ComputedValue {
+
+ private Collection validationStatusProviders;
+
+ public MaxSeverityValidationStatusProvider(DataBindingContext dbc) {
+ super(ValidationStatusProvider.class);
+ this.validationStatusProviders = dbc.getValidationStatusProviders();
+ }
+
+ protected Object calculate() {
+ int maxSeverity = IStatus.OK;
+ ValidationStatusProvider maxSeverityProvider = null;
+ for (Iterator it = validationStatusProviders.iterator(); it.hasNext();) {
+ ValidationStatusProvider provider = (ValidationStatusProvider) it
+ .next();
+ IStatus status = (IStatus) provider.getValidationStatus()
+ .getValue();
+ if (status.getSeverity() > maxSeverity) {
+ maxSeverity = status.getSeverity();
+ maxSeverityProvider = provider;
+ }
+ }
+ return maxSeverityProvider;
+ }
+
+ public synchronized void dispose() {
+ validationStatusProviders = null;
+ super.dispose();
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/MaxSeverityValidationStatusProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/ObservablePojo.java (from rev 25789, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/ObservablePojo.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/ObservablePojo.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.internal.common.databinding;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * A POJO base class that may notify observers on behalf of
+ * {@link PropertyChangeSupport}
+ */
+public abstract class ObservablePojo {
+
+ private PropertyChangeSupport propertyChangeSupport;
+
+ public ObservablePojo() {
+ this.propertyChangeSupport = new PropertyChangeSupport(this);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ protected PropertyChangeSupport getPropertyChangeSupport() {
+ return propertyChangeSupport;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/ObservablePojo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator (from rev 25789, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/CompositeValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java 2010-10-13 14:21:53 UTC (rev 25789)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/CompositeValidator.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.deltacloud.ui.common.databinding.validator;
+package org.jboss.tools.deltacloud.ui.internal.common.databinding.validator;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.Assert;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/MandatoryStringValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java 2010-10-13 14:21:53 UTC (rev 25789)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/databinding/validator/MandatoryStringValidator.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.deltacloud.ui.common.databinding.validator;
+package org.jboss.tools.deltacloud.ui.internal.common.databinding.validator;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/swt (from rev 25789, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/swt/JFaceUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java 2010-10-13 14:21:53 UTC (rev 25789)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/common/swt/JFaceUtils.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.deltacloud.ui.common.swt;
+package org.jboss.tools.deltacloud.ui.internal.common.swt;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecoration;
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/UIUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/UIUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/UIUtils.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.internal.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.menus.IMenuService;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UIUtils
+{
+
+ private UIUtils()
+ {
+ }
+
+ /**
+ * Returns the selection of the active workbench window.
+ *
+ * @return the selection
+ *
+ * @see IWorkbenchWindow#getSelectionService()
+ */
+ public static ISelection getWorkbenchWindowSelection()
+ {
+ return getActiveWorkbenchWindow().getSelectionService().getSelection();
+ }
+
+ /**
+ * Gets the structured selection.
+ *
+ * @return the structured selection
+ */
+ public static IStructuredSelection getStructuredSelection()
+ {
+ ISelection selection = getWorkbenchWindowSelection();
+ if ( selection instanceof IStructuredSelection )
+ {
+ return ( IStructuredSelection ) selection;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the first element.
+ *
+ * @param selection the selection
+ * @param expectedClass the expected class
+ *
+ * @return the first element
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T getFirstElement( final ISelection selection, final Class<T> expectedClass )
+ {
+ if ( selection == null )
+ {
+ return null;
+ }
+ else
+ {
+ Assert.isTrue( selection instanceof IStructuredSelection );
+ Object firstElement = ( ( IStructuredSelection ) selection ).getFirstElement();
+ if ( expectedClass.isAssignableFrom( firstElement.getClass() ) )
+ {
+ return ( T ) firstElement;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Gets the active page.
+ *
+ * @return the active page
+ */
+ public static IWorkbenchPage getActivePage()
+ {
+ IWorkbenchPage workbenchPage = getActiveWorkbenchWindow().getActivePage();
+ Assert.isNotNull( workbenchPage );
+ return workbenchPage;
+ }
+
+ /**
+ * Returns the editor that's currently active (focused).
+ *
+ * @return the active editor
+ */
+ public static IEditorPart getActiveEditor()
+ {
+ IEditorPart editor = getActivePage().getActiveEditor();
+ Assert.isNotNull( editor );
+ return editor;
+ }
+
+ /**
+ * Gets the active workbench window.
+ *
+ * @return the active workbench window
+ */
+ public static IWorkbenchWindow getActiveWorkbenchWindow()
+ {
+ IWorkbenchWindow workbenchWindow = getWorkbench().getActiveWorkbenchWindow();
+ Assert.isNotNull( workbenchWindow );
+ return workbenchWindow;
+ }
+
+ /**
+ * Gets the workbench.
+ *
+ * @return the workbench
+ */
+ public static IWorkbench getWorkbench()
+ {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ Assert.isNotNull( workbench );
+ return workbench;
+ }
+
+ /**
+ * Replaces an image with the given key by the given image descriptor.
+ *
+ * @param imageKey the image key
+ * @param imageDescriptor the image descriptor
+ */
+ public static void replaceInJfaceImageRegistry( final String imageKey, final ImageDescriptor imageDescriptor )
+ {
+ Assert.isNotNull( imageKey );
+ Assert.isNotNull( imageDescriptor );
+
+ JFaceResources.getImageRegistry().remove( imageKey );
+ JFaceResources.getImageRegistry().put( imageKey, imageDescriptor );
+ }
+
+ /**
+ * Register the given ContributionManager with the given id. The contribution manager gets unregistered on control disposal.
+ *
+ * @param id the id
+ * @param contributionManager the contribution manager
+ * @param control the control
+ *
+ * @see ContributionManager
+ * @see IMenuService
+ * @see DisposeListener
+ */
+ public static void registerContributionManager( final String id, final IContributionManager contributionManager,
+ final Control control )
+ {
+ Assert.isNotNull( id );
+ Assert.isNotNull( contributionManager );
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ final IMenuService menuService = ( IMenuService ) PlatformUI.getWorkbench().getService( IMenuService.class );
+ menuService.populateContributionManager( ( ContributionManager ) contributionManager, id );
+ contributionManager.update( true );
+ control.addDisposeListener( new DisposeListener()
+ {
+ public void widgetDisposed( DisposeEvent e )
+ {
+ menuService.releaseContributions( ( ContributionManager ) contributionManager );
+ }
+ } );
+ }
+
+ /**
+ * Creates context menu to a given control.
+ *
+ * @param control the control
+ *
+ * @return the i menu manager
+ */
+ public static IMenuManager createContextMenu( final Control control )
+ {
+ Assert.isTrue( control != null && !control.isDisposed() );
+
+ MenuManager menuManager = new MenuManager();
+ menuManager.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );
+
+ Menu menu = menuManager.createContextMenu( control );
+ control.setMenu( menu );
+ return menuManager;
+ }
+
+ /**
+ * Gets the dialog settings for the given identifer and plugin.
+ *
+ * @param identifier the identifier
+ * @param plugin the plugin
+ *
+ * @return the dialog settings
+ */
+ public static IDialogSettings getDialogSettings( final String identifier, final AbstractUIPlugin plugin )
+ {
+ Assert.isNotNull( plugin );
+ IDialogSettings dialogSettings = plugin.getDialogSettings();
+ IDialogSettings section = dialogSettings.getSection( identifier );
+ if ( section == null )
+ {
+ section = dialogSettings.addNewSection( identifier );
+ }
+ return section;
+ }
+
+ /**
+ * Returns the page for a given editor.
+ *
+ * @param editor the editor
+ * @return
+ *
+ * @return the page
+ *
+ * @see IWorkbenchPage
+ */
+ public static IWorkbenchPage getPage( EditorPart editor )
+ {
+ Assert.isNotNull( editor );
+ IWorkbenchPartSite site = editor.getSite();
+ Assert.isNotNull( site );
+ return site.getPage();
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/utils/UIUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards (from rev 25772, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnection.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnection.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
public interface CloudConnection {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionModel.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.io.BufferedReader;
import java.io.IOException;
@@ -29,7 +29,7 @@
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-import org.jboss.tools.deltacloud.ui.common.databinding.ObservablePojo;
+import org.jboss.tools.deltacloud.ui.internal.common.databinding.ObservablePojo;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CloudConnectionPage.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.net.URL;
@@ -48,9 +48,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-import org.jboss.tools.deltacloud.ui.common.databinding.validator.CompositeValidator;
-import org.jboss.tools.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
-import org.jboss.tools.deltacloud.ui.common.swt.JFaceUtils;
+import org.jboss.tools.deltacloud.ui.internal.common.databinding.validator.CompositeValidator;
+import org.jboss.tools.deltacloud.ui.internal.common.databinding.validator.MandatoryStringValidator;
+import org.jboss.tools.deltacloud.ui.internal.common.swt.JFaceUtils;
/**
* @author Jeff Jonhston
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CustomWizardDialog.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/CustomWizardDialog.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/EditCloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnection.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/EditCloudConnection.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.net.MalformedURLException;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilter.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilter.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.deltacloud.core.DeltaCloud;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilterPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ImageFilterPage.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ImageFilterPage.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilter.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilter.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.deltacloud.core.DeltaCloud;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilterPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/InstanceFilterPage.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/InstanceFilterPage.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeys.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeys.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.deltacloud.core.DeltaCloud;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeysPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ManageKeysPage.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -1,4 +1,4 @@
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.io.File;
import java.io.FilenameFilter;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewCloudConnection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewCloudConnection.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.net.MalformedURLException;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstance.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstance.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/NewInstancePage.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.util.ArrayList;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ProfileComposite.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/ProfileComposite.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.util.List;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/WizardMessages.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java 2010-10-13 07:35:26 UTC (rev 25772)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/internal/wizards/WizardMessages.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -8,7 +8,7 @@
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
-package org.jboss.tools.internal.deltacloud.ui.wizards;
+package org.jboss.tools.deltacloud.ui.internal.wizards;
import java.text.MessageFormat;
import java.util.MissingResourceException;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -14,14 +14,10 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -29,7 +25,6 @@
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
@@ -37,11 +32,9 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
@@ -52,15 +45,16 @@
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.core.ICloudManagerListener;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-import org.jboss.tools.internal.deltacloud.ui.wizards.EditCloudConnection;
-import org.jboss.tools.internal.deltacloud.ui.wizards.ImageFilter;
-import org.jboss.tools.internal.deltacloud.ui.wizards.InstanceFilter;
-import org.jboss.tools.internal.deltacloud.ui.wizards.NewCloudConnection;
-import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance;
+import org.jboss.tools.deltacloud.ui.internal.utils.UIUtils;
+import org.jboss.tools.deltacloud.ui.internal.wizards.ImageFilter;
+import org.jboss.tools.deltacloud.ui.internal.wizards.InstanceFilter;
+import org.jboss.tools.deltacloud.ui.internal.wizards.NewInstance;
public class DeltaCloudView extends ViewPart implements ICloudManagerListener,
ITabbedPropertySheetPageContributor {
+ private static final String CONTEXT_MENU_ID = "popup:org.jboss.tools.deltacloud.menus.cloudviewer";
+
/**
* The ID of the view as specified by the extension.
*/
@@ -89,8 +83,6 @@
private TreeViewer viewer;
- private Action createConnection;
- private Action disconnectCloud;
private Action refreshAction;
private Action startAction;
private Action stopAction;
@@ -99,7 +91,6 @@
private Action collapseall;
private Action doubleClickAction;
private Action createInstance;
- private Action editCloud;
private Action imageFilterAction;
private Action instanceFilterAction;
@@ -151,16 +142,10 @@
}
private void hookContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu");
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- DeltaCloudView.this.fillContextMenu(manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
+ IMenuManager contextMenu = UIUtils.createContextMenu(viewer.getControl());
+ // TODO: replace by declarative commands
+ fillContextMenu(contextMenu);
+ UIUtils.registerContributionManager(CONTEXT_MENU_ID, contextMenu, viewer.getControl());
}
private void contributeToActionBars() {
@@ -178,8 +163,6 @@
private void handleSelection() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
selectedElement = (CloudViewElement) selection.getFirstElement();
- editCloud.setEnabled(selectedElement != null);
- disconnectCloud.setEnabled(selectedElement != null);
refreshAction.setEnabled(selectedElement != null);
imageFilterAction.setEnabled(selectedElement != null);
instanceFilterAction.setEnabled(selectedElement != null);
@@ -187,9 +170,6 @@
private void fillLocalPullDown(IMenuManager manager) {
manager.removeAll();
- manager.add(createConnection);
- manager.add(editCloud);
- manager.add(disconnectCloud);
manager.add(refreshAction);
manager.add(imageFilterAction);
manager.add(instanceFilterAction);
@@ -205,15 +185,13 @@
for (String action : actions) {
manager.add(instanceActions.get(action));
}
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ // manager.add(new
+ // Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
- manager.add(createConnection);
- manager.add(editCloud);
- manager.add(disconnectCloud);
manager.add(imageFilterAction);
manager.add(instanceFilterAction);
// Other plug-ins can contribute there actions here
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ // manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
private void fillLocalToolBar(IToolBarManager manager) {
@@ -221,10 +199,7 @@
}
private void makeActions() {
- createConnection = createNewConnectionAction();
- disconnectCloud = createDisconnectAction();
createInstance = createInstanceAction();
- editCloud = createEditCloudAction();
refreshAction = createRefreshAction();
startAction = createStartAction();
stopAction = createStopAction();
@@ -252,23 +227,6 @@
}
- private Action createNewConnectionAction() {
- Action createConnection = new Action() {
- public void run() {
- NewCloudConnection wizard = new NewCloudConnection();
- wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
- wizard);
- dialog.create();
- dialog.open();
- }
- };
- createConnection.setText(CVMessages.getString(NEW_CONNECTION));
- createConnection.setToolTipText(CVMessages.getString(NEW_CONNECTION));
- createConnection.setImageDescriptor(SWTImagesFactory.DESC_CLOUD);
- return createConnection;
- }
-
private Action createCollapseAllAction() {
Action collapseAll = new Action() {
public void run() {
@@ -296,7 +254,6 @@
@Override
public void run() {
- // TODO Auto-generated method stub
Shell shell = viewer.getControl().getShell();
IWizard wizard = new InstanceFilter(cloud);
WizardDialog dialog = new WizardDialog(shell, wizard);
@@ -330,7 +287,6 @@
@Override
public void run() {
- // TODO Auto-generated method stub
Shell shell = viewer.getControl().getShell();
IWizard wizard = new ImageFilter(cloud);
WizardDialog dialog = new WizardDialog(shell, wizard);
@@ -492,59 +448,62 @@
return refreshAction;
}
- private Action createEditCloudAction() {
- Action editCloud = new Action() {
- public void run() {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- CloudViewElement element = (CloudViewElement) selection.getFirstElement();
- while (element != null && !(element instanceof CVCloudElement)) {
- element = (CloudViewElement) element.getParent();
- }
- if (element != null) {
- CVCloudElement cloudElement = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
- IWizard wizard = new EditCloudConnection(cloud);
- Shell shell = viewer.getControl().getShell();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.open();
- }
- }
- };
- editCloud.setText(CVMessages.getString(EDIT_CLOUD));
- editCloud.setToolTipText(CVMessages.getString(EDIT_CLOUD));
- editCloud.setEnabled(selectedElement != null);
- return editCloud;
- }
+ // private Action createEditCloudAction() {
+ // Action editCloud = new Action() {
+ // public void run() {
+ // IStructuredSelection selection = (IStructuredSelection)
+ // viewer.getSelection();
+ // CloudViewElement element = (CloudViewElement)
+ // selection.getFirstElement();
+ // while (element != null && !(element instanceof CVCloudElement)) {
+ // element = (CloudViewElement) element.getParent();
+ // }
+ // if (element != null) {
+ // CVCloudElement cloudElement = (CVCloudElement) element;
+ // DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ // IWizard wizard = new EditCloudConnection(cloud);
+ // Shell shell = viewer.getControl().getShell();
+ // WizardDialog dialog = new WizardDialog(shell, wizard);
+ // dialog.create();
+ // dialog.open();
+ // }
+ // }
+ // };
+ // editCloud.setText(CVMessages.getString(EDIT_CLOUD));
+ // editCloud.setToolTipText(CVMessages.getString(EDIT_CLOUD));
+ // editCloud.setEnabled(selectedElement != null);
+ // return editCloud;
+ // }
- private Action createDisconnectAction() {
- Action removeCloud = new Action() {
- public void run() {
- DisconnectCloudsDialog dialog = new DisconnectCloudsDialog(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
- , ((IStructuredSelection) viewer.getSelection()).toList());
- if (Dialog.OK == dialog.open()) {
- removeCloudViewElements(dialog.getResult());
- }
- }
+ // private Action createDisconnectAction() {
+ // Action removeCloud = new Action() {
+ // public void run() {
+ // DisconnectCloudsDialog dialog = new DisconnectCloudsDialog(
+ // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
+ // , ((IStructuredSelection) viewer.getSelection()).toList());
+ // if (Dialog.OK == dialog.open()) {
+ // removeCloudViewElements(dialog.getResult());
+ // }
+ // }
+ //
+ // private void removeCloudViewElements(Object[] cloudViewerElements) {
+ // // viewer.remove(cloudViewerElements);
+ // for (Object cloudViewElement : cloudViewerElements) {
+ // Assert.isTrue(cloudViewElement instanceof CloudViewElement);
+ // DeltaCloud deltaCloud = (DeltaCloud) ((CloudViewElement)
+ // cloudViewElement).getElement();
+ // DeltaCloudManager.getDefault().removeCloud(deltaCloud);
+ // }
+ // }
+ // };
+ // removeCloud.setText(CVMessages.getString(REMOVE_CLOUD));
+ // removeCloud.setToolTipText(CVMessages.getString(REMOVE_CLOUD));
+ // removeCloud.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ // getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE));
+ // removeCloud.setEnabled(selectedElement != null);
+ // return removeCloud;
+ // }
- private void removeCloudViewElements(Object[] cloudViewerElements) {
- viewer.remove(cloudViewerElements);
- for (Object cloudViewElement : cloudViewerElements) {
- Assert.isTrue(cloudViewElement instanceof CloudViewElement);
- DeltaCloud deltaCloud = (DeltaCloud) ((CloudViewElement) cloudViewElement).getElement();
- DeltaCloudManager.getDefault().removeCloud(deltaCloud);
- }
- }
- };
- removeCloud.setText(CVMessages.getString(REMOVE_CLOUD));
- removeCloud.setToolTipText(CVMessages.getString(REMOVE_CLOUD));
- removeCloud.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
- getImageDescriptor(ISharedImages.IMG_ELCL_REMOVE));
- removeCloud.setEnabled(selectedElement != null);
- return removeCloud;
- }
-
private Action createInstanceAction() {
Action createInstance = new Action() {
public void run() {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -58,8 +58,8 @@
import org.jboss.tools.deltacloud.core.IImageListListener;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-import org.jboss.tools.internal.deltacloud.ui.wizards.ImageFilter;
-import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance;
+import org.jboss.tools.deltacloud.ui.internal.wizards.ImageFilter;
+import org.jboss.tools.deltacloud.ui.internal.wizards.NewInstance;
import org.osgi.service.prefs.Preferences;
public class ImageView extends ViewPart implements ICloudManagerListener, IImageListListener {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-10-13 15:51:43 UTC (rev 25794)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-10-13 15:55:57 UTC (rev 25795)
@@ -75,7 +75,7 @@
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-import org.jboss.tools.internal.deltacloud.ui.wizards.InstanceFilter;
+import org.jboss.tools.deltacloud.ui.internal.wizards.InstanceFilter;
import org.osgi.service.prefs.Preferences;
public class InstanceView extends ViewPart implements ICloudManagerListener, IInstanceListListener {
14 years, 3 months
JBoss Tools SVN: r25794 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-13 11:51:43 -0400 (Wed, 13 Oct 2010)
New Revision: 25794
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
Log:
added copyright header
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2010-10-13 15:48:46 UTC (rev 25793)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2010-10-13 15:51:43 UTC (rev 25794)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.deltacloud.core;
import java.util.regex.PatternSyntaxException;
14 years, 3 months
JBoss Tools SVN: r25793 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-10-13 11:48:46 -0400 (Wed, 13 Oct 2010)
New Revision: 25793
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/PreferencesClassPathUtils.java
Log:
https://jira.jboss.org/browse/JBIDE-7255 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/PreferencesClassPathUtils.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/PreferencesClassPathUtils.java 2010-10-13 14:59:30 UTC (rev 25792)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/PreferencesClassPathUtils.java 2010-10-13 15:48:46 UTC (rev 25793)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.hibernate.console.preferences;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
@@ -33,8 +34,9 @@
String[] driverURLParts = driverURL.split(";"); //$NON-NLS-1$
urls = new URL[driverURLParts.length];
for (int i = 0; i < driverURLParts.length; i++) {
+ File file = new File(driverURLParts[i].trim());
try {
- urls[i] = new URL("file:/" + driverURLParts[i].trim()); //$NON-NLS-1$
+ urls[i] = file.toURL();
} catch (MalformedURLException e) {
urls[i] = null;
}
14 years, 3 months
JBoss Tools SVN: r25792 - in trunk: jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-10-13 10:59:30 -0400 (Wed, 13 Oct 2010)
New Revision: 25792
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
Log:
https://jira.jboss.org/browse/JBIDE-7299
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-10-13 14:58:31 UTC (rev 25791)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-10-13 14:59:30 UTC (rev 25792)
@@ -431,9 +431,7 @@
name="el-RenameMethodParticipant">
<enablement>
<with variable="element">
- <or>
- <instanceof value="org.eclipse.jdt.core.IMethod"/>
- </or>
+ <instanceof value="org.eclipse.jdt.core.IMethod"/>
</with>
</enablement>
</renameParticipant>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2010-10-13 14:58:31 UTC (rev 25791)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2010-10-13 14:59:30 UTC (rev 25792)
@@ -27,6 +27,8 @@
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
import org.eclipse.ltk.internal.core.refactoring.Messages;
import org.eclipse.text.edits.MultiTextEdit;
@@ -38,19 +40,17 @@
import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
-public class RenameMethodParticipant extends RenameParticipant{
+public class RenameMethodParticipant extends RenameParticipant implements ISharableParticipant{
private IJavaElement element;
private String oldName;
private String newName;
- private SeamRenameMethodSearcher searcher;
+ private RenameMethodSearcher searcher;
private RefactoringStatus status;
private CompositeChange rootChange;
private TextFileChange lastChange;
private ArrayList<String> keys = new ArrayList<String>();
+ private ArrayList<Object> otherElements = new ArrayList<Object>();
- private static boolean added = false;
-
-
@Override
public RefactoringStatus checkConditions(IProgressMonitor pm,
CheckConditionsContext context) throws OperationCanceledException {
@@ -58,24 +58,38 @@
return status;
if(element instanceof IMethod){
IMethod method = (IMethod)element;
- if(method != null && !added){
- if(searcher.isGetter(method))
- status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
- else if(searcher.isSetter(method))
- status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
- added = true;
+ IMethod anotherMethod = getAnotherMethod();
+ if(method != null){
+ if(searcher.isGetter(method)){
+ if(anotherMethod == null || searcher.isGetter(anotherMethod))
+ status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_GETTER_WARNING);
+
+ }else if(searcher.isSetter(method)){
+ if(anotherMethod == null || searcher.isSetter(anotherMethod))
+ status.addWarning(JsfUIMessages.RENAME_METHOD_PARTICIPANT_SETTER_WARNING);
+ }
+
+ searcher.findELReferences();
}
}
- searcher.findELReferences();
-
return status;
}
+
+ private IMethod getAnotherMethod(){
+ for(Object object : otherElements)
+ if(object instanceof IMethod)
+ return (IMethod)object;
+ return null;
+ }
@Override
public Change createChange(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
- return rootChange;
+ if(rootChange.getChildren().length > 0)
+ return rootChange;
+
+ return null;
}
@Override
@@ -85,6 +99,9 @@
@Override
protected boolean initialize(Object element) {
+ if(!getArguments().getUpdateReferences())
+ return false;
+
if(element instanceof IMethod){
IMethod method = (IMethod)element;
status = new RefactoringStatus();
@@ -96,8 +113,7 @@
oldName = method.getElementName();
newName = RefactorSearcher.getPropertyName(method, getArguments().getNewName());
- searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
- added = false;
+ searcher = new RenameMethodSearcher((IFile)method.getResource(), oldName);
return true;
}
return false;
@@ -116,8 +132,7 @@
oldName = method.getElementName();
this.newName = newName;
- searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
- added = false;
+ searcher = new RenameMethodSearcher((IFile)method.getResource(), oldName);
return true;
}
return false;
@@ -152,9 +167,9 @@
}
}
- class SeamRenameMethodSearcher extends RefactorSearcher{
+ class RenameMethodSearcher extends RefactorSearcher{
ProjectsSet projectSet=null;
- public SeamRenameMethodSearcher(IFile file, String name){
+ public RenameMethodSearcher(IFile file, String name){
super(file, name, element);
ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
if(extensions.length > 0){
@@ -205,4 +220,8 @@
}
}
+ public void addElement(Object element, RefactoringArguments arguments) {
+ otherElements.add(element);
+ }
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-13 14:58:31 UTC (rev 25791)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2010-10-13 14:59:30 UTC (rev 25792)
@@ -213,6 +213,9 @@
continue;
List<ELSegment> segments = resolution.findSegmentsByJavaElement(javaElement);
+
+ if(segments == null)
+ continue;
for(ELSegment segment : segments){
match(file, offset+segment.getSourceReference().getStartPosition(), segment.getSourceReference().getLength());
14 years, 3 months