JBoss Tools SVN: r38699 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard: appimport and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-14 09:22:47 -0500 (Tue, 14 Feb 2012)
New Revision: 38699
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java
Log:
Open - JBIDE-10899 There are many deprecated classes that we should clean up
https://issues.jboss.org/browse/JBIDE-10899
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,556 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.WritableValue;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.MultiValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.resources.IProject;
-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.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.tools.common.ui.databinding.DataBindingUtils;
-import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
-import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
-import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.ValidationStatusControlDecoration;
-import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizard;
-import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim
- * @author Rob Stryker
- *
- */
-@Deprecated
-public class AdapterWizardPage extends AbstractOpenShiftWizardPage implements IWizardPage, PropertyChangeListener {
-
- private AdapterWizardPageModel model;
- private Text cloneUriValueText;
- private Label domainValueLabel;
- private Label modeValueLabel;
- private Button serverAdapterCheckbox;
- private IServerType serverTypeToCreate;
-
- private IObservableValue serverAdapterCheckboxObservable;
- private IObservableValue newProjectCheckboxIsEnabled;
-
- public AdapterWizardPage(ImportProjectWizard wizard, ImportProjectWizardModel model) {
- super(
- "Import OpenShift application",
- "Choose to create a new/use existing project, " +
- "the GIT branch and clone destination, "
- + "and configure your server adapter ",
- "Server Adapter",
- wizard);
- this.model = new AdapterWizardPageModel(model);
- model.addPropertyChangeListener(this);
- }
-
- @Override
- protected void doCreateControls(Composite parent, DataBindingContext dbc) {
- GridLayoutFactory.fillDefaults().applyTo(parent);
-
- Group mergeGroup = createProjectGroup(parent, dbc);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(mergeGroup);
-
- Group cloneGroup = createCloneGroup(parent, dbc);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(cloneGroup);
-
- Group serverAdapterGroup = createAdapterGroup(parent, dbc);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(serverAdapterGroup);
-
- Label fillerLabel = new Label(parent, SWT.NONE);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(fillerLabel);
-
- }
-
- private Group createProjectGroup(Composite parent, DataBindingContext dbc) {
- Group projectGroup = new Group(parent, SWT.BORDER);
- projectGroup.setText("Project");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(projectGroup);
- GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(projectGroup);
-
- Button newProjectCheckbox = new Button(projectGroup, SWT.CHECK);
- newProjectCheckbox.setText("Create new Project");
- GridDataFactory.fillDefaults()
- .span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, true).applyTo(newProjectCheckbox);
- IObservableValue newProjectObservable =
- BeanProperties.value(AdapterWizardPageModel.PROPERTY_NEW_PROJECT).observe(model);
- ValueBindingBuilder
- .bind(WidgetProperties.selection().observe(newProjectCheckbox))
- .to(newProjectObservable)
- .in(dbc);
-
- this.newProjectCheckboxIsEnabled = WidgetProperties.enabled().observe(newProjectCheckbox);
-
- Label existingProjectLabel = new Label(projectGroup, SWT.NONE);
- existingProjectLabel.setText("Existing Project");
- GridDataFactory
- .fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(existingProjectLabel);
- ValueBindingBuilder
- .bind(WidgetProperties.enabled().observe(existingProjectLabel))
- .notUpdating(newProjectObservable)
- .converting(new InvertingBooleanConverter())
- .in(dbc);
-
- Text newProjectText = new Text(projectGroup, SWT.BORDER);
- newProjectText.setEditable(false);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER).grab(true, true).applyTo(newProjectText);
-
- IObservableValue newProjectNameObservable =
- BeanProperties.value(AdapterWizardPageModel.PROPERTY_PROJECT_NAME).observe(model);
- ValueBindingBuilder
- .bind(WidgetProperties.text().observe(newProjectText))
- .to(newProjectNameObservable)
- .in(dbc);
- ValueBindingBuilder
- .bind(WidgetProperties.enabled().observe(newProjectText))
- .notUpdating(newProjectObservable)
- .converting(new InvertingBooleanConverter())
- .in(dbc);
- MultiValidator newProjectValidator = new NewProjectValidator(newProjectObservable, newProjectNameObservable);
- dbc.addValidationStatusProvider(newProjectValidator);
- new ValidationStatusControlDecoration(newProjectValidator).showFor(newProjectText, SWT.TOP | SWT.LEFT);
-
- Button browseProjectsButton = new Button(projectGroup, SWT.NONE);
- browseProjectsButton.setText("Browse");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseProjectsButton);
- browseProjectsButton.addSelectionListener(onBrowseProjects());
- ValueBindingBuilder
- .bind(WidgetProperties.enabled().observe(browseProjectsButton))
- .notUpdating(newProjectObservable)
- .converting(new InvertingBooleanConverter())
- .in(dbc);
-
- return projectGroup;
- }
-
- private Group createCloneGroup(Composite parent, DataBindingContext dbc) {
- Group cloneGroup = new Group(parent, SWT.BORDER);
- cloneGroup.setText("Git clone");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cloneGroup);
- GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(4).applyTo(cloneGroup);
-
- Label gitUriLabel = new Label(cloneGroup, SWT.NONE);
- gitUriLabel.setText("Cloning From");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(gitUriLabel);
-
- cloneUriValueText = new Text(cloneGroup, SWT.BORDER);
- cloneUriValueText.setEditable(false);
- GridDataFactory
- .fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cloneUriValueText);
- ValueBindingBuilder
- .bind(WidgetProperties.text(SWT.Modify).observe(cloneUriValueText))
- .notUpdating(BeanProperties.value(AdapterWizardPageModel.PROPERTY_CLONE_URI).observe(model))
- .in(dbc);
- ValueBindingBuilder
- .bind(WidgetProperties.enabled().observe(cloneUriValueText))
- .notUpdating(BeanProperties.value(AdapterWizardPageModel.PROPERTY_LOADING).observe(model))
- .converting(new InvertingBooleanConverter())
- .in(dbc);
-
- // bind loading state to page complete
- ValueBindingBuilder
- .bind(new WritableValue(false, Boolean.class))
- .notUpdating(BeanProperties.value(AdapterWizardPageModel.PROPERTY_LOADING).observe(model))
- .validatingAfterGet(new IValidator() {
-
- @Override
- public IStatus validate(Object value) {
- if (Boolean.FALSE.equals(value)) {
- return ValidationStatus.ok();
- } else {
- return ValidationStatus.cancel("Loading...");
- }
- }
- })
- .in(dbc);
-
- Label repoPathLabel = new Label(cloneGroup, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(repoPathLabel);
- repoPathLabel.setText("Destination");
-
- Button defaultRepoPathButton = new Button(cloneGroup, SWT.CHECK);
- defaultRepoPathButton.setText("default");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRepoPathButton);
- defaultRepoPathButton.addSelectionListener(onDefaultRepoPath());
- IObservableValue defaultRepoButtonSelection = WidgetProperties.selection().observe(defaultRepoPathButton);
-
- Text repoPathText = new Text(cloneGroup, SWT.BORDER);
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(repoPathText);
- DataBindingUtils.bindMandatoryTextField(
- repoPathText, "Location", AdapterWizardPageModel.PROPERTY_REPO_PATH, model, dbc);
- ValueBindingBuilder
- .bind(defaultRepoButtonSelection)
- .converting(new InvertingBooleanConverter())
- .to(WidgetProperties.enabled().observe(repoPathText))
- .notUpdatingParticipant()
- .in(dbc);
-
- Button browseRepoPathButton = new Button(cloneGroup, SWT.PUSH);
- browseRepoPathButton.setText("Browse");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(browseRepoPathButton);
- browseRepoPathButton.addSelectionListener(onRepoPath());
- ValueBindingBuilder
- .bind(defaultRepoButtonSelection)
- .converting(new InvertingBooleanConverter())
- .to(WidgetProperties.enabled().observe(browseRepoPathButton))
- .notUpdatingParticipant()
- .in(dbc);
-
- defaultRepoButtonSelection.setValue(true);
-
- Label remoteNameLabel = new Label(cloneGroup, SWT.NONE);
- remoteNameLabel.setText("Remote name");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(remoteNameLabel);
-
- Button defaultRemoteNameButton = new Button(cloneGroup, SWT.CHECK);
- defaultRemoteNameButton.setText("default");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).applyTo(defaultRemoteNameButton);
- defaultRemoteNameButton.addSelectionListener(onDefaultRemoteName());
-
- Text remoteNameText = new Text(cloneGroup, SWT.BORDER);
- GridDataFactory.fillDefaults()
- .span(2, 1).align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
- .applyTo(remoteNameText);
- DataBindingUtils.bindMandatoryTextField(
- remoteNameText, "Remote name", AdapterWizardPageModel.PROPERTY_REMOTE_NAME, model, dbc);
-
- IObservableValue defaultRemoteNameSelection = WidgetProperties.selection().observe(defaultRemoteNameButton);
- ValueBindingBuilder
- .bind(defaultRemoteNameSelection)
- .converting(new InvertingBooleanConverter())
- .to(WidgetProperties.enabled().observe(remoteNameText))
- .notUpdatingParticipant()
- .in(dbc);
- defaultRemoteNameSelection.setValue(true);
-
- Link sshPrefsLink = new Link(cloneGroup, SWT.NONE);
- sshPrefsLink
- .setText("Make sure your SSH key used with the domain is listed in <a>SSH2 Preferences</a>");
- GridDataFactory.fillDefaults()
- .span(4, 1).align(SWT.FILL, SWT.CENTER).indent(0, 10).applyTo(sshPrefsLink);
- sshPrefsLink.addSelectionListener(onSshPrefs());
-
- return cloneGroup;
- }
-
- private SelectionListener onBrowseProjects() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- SelectExistingProjectDialog dialog =
- new SelectExistingProjectDialog(model.getApplicationName(), getShell());
- if (dialog.open() == Dialog.OK) {
- Object selectedProject = dialog.getFirstResult();
- if (selectedProject instanceof IProject) {
- model.setProjectName(((IProject) selectedProject).getName());
- }
- }
- }
-
- };
- }
-
- private SelectionListener onDefaultRepoPath() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- model.resetRepositoryPath();
- }
- };
- }
-
- private SelectionListener onRepoPath() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage("Choose the location to store your repository clone to...");
- String repositoryPath = dialog.open();
- if (repositoryPath != null) {
- model.setRepositoryPath(repositoryPath);
- }
- }
- };
- }
-
- private SelectionListener onDefaultRemoteName() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- model.resetRemoteName();
- }
- };
- }
-
- private SelectionAdapter onSshPrefs() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- SshPrivateKeysPreferences.openPreferencesPage(getShell());
- }
- };
- }
-
- private Group createAdapterGroup(Composite parent, DataBindingContext dbc) {
- Group serverAdapterGroup = new Group(parent, SWT.BORDER);
- serverAdapterGroup.setText("Server Adapter");
- GridLayoutFactory.fillDefaults().margins(6, 6).applyTo(serverAdapterGroup);
-
- Composite c = new Composite(serverAdapterGroup, SWT.NONE);
- GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(c);
- GridLayoutFactory.fillDefaults().numColumns(3).spacing(12, 8).applyTo(c);
-
- serverAdapterCheckbox = new Button(c, SWT.CHECK);
- serverAdapterCheckbox.setText("Create OpenShift Server Adapter");
- GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER)
- .grab(true, false).applyTo(serverAdapterCheckbox);
- serverAdapterCheckbox.addSelectionListener(onCreateAdapter());
-
- Label domainLabel = new Label(c, SWT.NONE);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(domainLabel);
- domainLabel.setText("Host");
- domainValueLabel = new Label(c, SWT.NONE);
- GridDataFactory.fillDefaults()
- .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(domainValueLabel);
- ValueBindingBuilder
- .bind(WidgetProperties.text().observe(domainValueLabel))
- .notUpdating(BeanProperties.value(AdapterWizardPageModel.PROPERTY_APPLICATION_URL).observe(model))
- .in(dbc);
-
- Label modeLabel = new Label(c, SWT.NONE);
- modeLabel.setText("Mode");
- GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).applyTo(modeLabel);
- modeValueLabel = new Label(c, SWT.NONE);
- GridDataFactory.fillDefaults()
- .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(modeValueLabel);
-
- model.getWizardModel().setProperty(
- AdapterWizardPageModel.CREATE_SERVER, serverAdapterCheckbox.getSelection());
- this.serverAdapterCheckboxObservable =
- WidgetProperties.selection().observe(serverAdapterCheckbox);
-
- return serverAdapterGroup;
- }
-
- private SelectionListener onCreateAdapter() {
- return new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.getWizardModel().setProperty(
- AdapterWizardPageModel.CREATE_SERVER, serverAdapterCheckbox.getSelection());
- enableServerWidgets(serverAdapterCheckbox.getSelection());
- }
- };
- }
-
- protected void enableServerWidgets(boolean enabled) {
- domainValueLabel.setEnabled(enabled);
- modeValueLabel.setEnabled(enabled);
- }
-
- private IServerType getServerTypeToCreate() {
- return ServerCore.findServerType("org.jboss.tools.openshift.express.openshift.server.type");
- }
-
- protected void onPageActivated(DataBindingContext dbc) {
- // allow to enable a proj only for as7 openshift applications
- setTitle(NLS.bind("Import OpenShift application {0}", model.getApplicationName()));
-
- newProjectCheckboxIsEnabled.setValue(model.isJBossAS7Application());
-
- model.resetRepositoryPath();
- serverTypeToCreate = getServerTypeToCreate();
- model.getWizardModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
- modeValueLabel.setText("Source");
- model.getWizardModel().setProperty(AdapterWizardPageModel.MODE, AdapterWizardPageModel.MODE_SOURCE);
- onPageActivatedBackground(dbc);
- }
-
- protected void onPageActivatedBackground(final DataBindingContext dbc) {
- new Job("Loading remote OpenShift application") {
- public IStatus run(IProgressMonitor monitor) {
- try {
- model.loadGitUri();
- model.loadApplicationUrl();
- } catch (OpenShiftException e) {
- IStatus status = OpenShiftUIActivator.createErrorStatus(e.getMessage(), e);
- OpenShiftUIActivator.log(status);
- return status;
- }
- return Status.OK_STATUS;
- }
- }.schedule();
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (ImportProjectWizardModel.APPLICATION.equals(evt.getPropertyName())) {
- handleApplicationChanged();
- }
- }
-
- private void handleApplicationChanged() {
- // we need to enable or disable all the server widgets depending on
- // if we can make a server out of this
- serverTypeToCreate = getServerTypeToCreate();
- boolean canCreateServer = serverTypeToCreate != null;
- serverAdapterCheckbox.setEnabled(canCreateServer);
- serverAdapterCheckboxObservable.setValue(canCreateServer);
- enableServerWidgets(canCreateServer);
- model.getWizardModel().setProperty(AdapterWizardPageModel.SERVER_TYPE, serverTypeToCreate);
- model.getWizardModel().setProperty(AdapterWizardPageModel.CREATE_SERVER, canCreateServer);
- }
-
- /**
- * A multi validator that validates the state of the project that shall be
- * (OpenShift) enabled
- */
- private class NewProjectValidator extends MultiValidator {
-
- private IObservableValue newProjectObservable;
- private IObservableValue newProjectNameObservable;
-
- public NewProjectValidator(IObservableValue newProjectObservable,
- IObservableValue newProjectNameObservable) {
- this.newProjectObservable = newProjectObservable;
- this.newProjectNameObservable = newProjectNameObservable;
- }
-
- @Override
- protected IStatus validate() {
- /**
- * WARNING: it is important to evaluate the validation state on
- * behalf of observable values (not widgets!). The multi validator
- * is tracking what observables are read to know when he has to
- * recalculate it's state.
- */
- if (Boolean.TRUE.equals(newProjectObservable.getValue())) {
- return ValidationStatus.ok();
- }
-
- if (newProjectNameObservable.getValue() != null
- && (!((String) newProjectNameObservable.getValue()).isEmpty())) {
- return ValidationStatus.ok();
- } else {
- return ValidationStatus.error(
- "Select an existing project to use with OpenShift");
- }
- }
- }
-
- // private static class GitUriLabelProvider implements ILabelProvider {
- //
- // @Override
- // public void addListener(ILabelProviderListener listener) {
- // }
- //
- // @Override
- // public void dispose() {
- // }
- //
- // @Override
- // public boolean isLabelProperty(Object element, String property) {
- // return true;
- // }
- //
- // @Override
- // public void removeListener(ILabelProviderListener listener) {
- // }
- //
- // @Override
- // public Image getImage(Object element) {
- // return null;
- // }
- //
- // @Override
- // public String getText(Object element) {
- // if (!(element instanceof GitUri)) {
- // return null;
- // }
- // return ((GitUri) element).getLabel();
- // }
- // }
-
- // private class MergeUriValidator implements IValidator {
- //
- // @Override
- // public IStatus validate(Object value) {
- // String mergeUri = (String) value;
- // if (mergeUri == null
- // || mergeUri.length() == 0) {
- // return ValidationStatus
- // .warning("You have to provide a git uri to merge with");
- // }
- // GitUri gitUri = model.getKnownMergeUri(mergeUri);
- // if (gitUri == null) {
- // return ValidationStatus
- // .warning("You are not merging with an official example. Things may go wrong");
- // }
- // if (!model.isCompatibleToApplicationCartridge(gitUri.getCartridge())) {
- // return ValidationStatus
- // .warning("The example you've chosen is not compatible to your application");
- // }
- // return ValidationStatus.ok();
- // }
- // }
-
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
-import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.ICartridge;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author Andr� Dietisheim
- * @author Rob Stryker
- * @author Xavier Coulon
- */
-@Deprecated
-public class AdapterWizardPageModel extends ObservableUIPojo {
-
- private static final String REMOTE_NAME_DEFAULT = "origin";
-
- public static final String PROPERTY_NEW_PROJECT = "newProject";
- public static final String PROPERTY_CLONE_URI = "cloneUri";
-// public static final String PROPERTY_MERGE_URI = "mergeUri";
- public static final String PROPERTY_PROJECT_NAME = "projectName";
- public static final String PROPERTY_APPLICATION_URL = "applicationUrl";
- public static final String PROPERTY_REPO_PATH = "repositoryPath";
- public static final String PROPERTY_REMOTE_NAME = "remoteName";
- public static final String PROPERTY_LOADING = "loading";
-
- public static final String CREATE_SERVER = "createServer";
- public static final String MODE = "serverMode";
- public static final String MODE_SOURCE = "serverModeSource";
- public static final String MODE_BINARY = "serverModeBinary";
- public static final String SERVER_TYPE = "serverType";
-
- private ImportProjectWizardModel wizardModel;
- private boolean loading;
-
- public AdapterWizardPageModel(ImportProjectWizardModel wizardModel) {
- this.wizardModel = wizardModel;
- setRemoteName(REMOTE_NAME_DEFAULT);
- setNewProject(true);
- }
-
- public void setNewProject(boolean newProject) {
- firePropertyChange(PROPERTY_NEW_PROJECT, wizardModel.isNewProject(), wizardModel.setNewProject(newProject));
- }
-
- public boolean isNewProject() {
- return wizardModel.isNewProject();
- }
-
- public void setProjectName(String projectName) {
- firePropertyChange(PROPERTY_PROJECT_NAME, wizardModel.getProjectName(), wizardModel.setProjectName(projectName));
- }
-
- public String getProjectName() {
- return wizardModel.getProjectName();
- }
-
-// public void setMergeUri(String mergeUri) {
-// firePropertyChange(PROPERTY_MERGE_URI, wizardModel.getMergeUri(), wizardModel.setMergeUri(mergeUri));
-// }
-//
-// public String getMergeUri() {
-// return wizardModel.getMergeUri();
-// }
-
-// public GitUri getKnownMergeUri(String uriOrLabel) {
-// GitUri gitUri = null;
-// if (isGitUri(uriOrLabel)) {
-// gitUri = getKnownMergeUriByUri(uriOrLabel);
-// } else {
-// gitUri = getKnownMergeUriByLabel(uriOrLabel);
-// }
-// return gitUri;
-// }
-
-// private boolean isGitUri(String gitUriString) {
-// try {
-// URIish uriish = new URIish(gitUriString);
-// return uriish.isRemote();
-// } catch (URISyntaxException e) {
-// return false;
-// }
-// }
-
-// private GitUri getKnownMergeUriByUri(String gitUriString) {
-// GitUri matchingGitUri = null;
-// for (GitUri gitUri : getMergeUris()) {
-// if (gitUri.getGitUri().equals(gitUriString)) {
-// matchingGitUri = gitUri;
-// break;
-// }
-// }
-// return matchingGitUri;
-// }
-
-// private GitUri getKnownMergeUriByLabel(String label) {
-// GitUri matchingGitUri = null;
-// for (GitUri gitUri : getMergeUris()) {
-// if (gitUri.getLabel().equals(label)) {
-// matchingGitUri = gitUri;
-// break;
-// }
-// }
-// return matchingGitUri;
-// }
-
-// public List<GitUri> getMergeUris() {
-// ArrayList<GitUri> mergeUris = new ArrayList<GitUri>();
-// mergeUris.add(new GitUri(
-// "seambooking-example", "git://github.com/openshift/seambooking-example.git",
-// ICartridge.JBOSSAS_7));
-// mergeUris.add(new GitUri(
-// "tweetstream-example", "git://github.com/openshift/tweetstream-example.git",
-// ICartridge.JBOSSAS_7));
-// mergeUris.add(new GitUri(
-// "sinatra-example", "git://github.com/openshift/sinatra-example.git",
-// new Cartridge("rack-1.1")));
-// mergeUris.add(new GitUri(
-// "sugarcrm-example", "git://github.com/openshift/sugarcrm-example.git",
-// new Cartridge("php-5.3")));
-// return mergeUris;
-// }
-
- public void loadGitUri() throws OpenShiftException {
- setLoading(true);
- setCloneUri("Loading...");
- setCloneUri(getCloneUri());
- setLoading(false);
- }
-
- private void setCloneUri(String gitUri) {
- firePropertyChange(PROPERTY_CLONE_URI, null, gitUri);
- }
-
- public String getCloneUri() throws OpenShiftException {
- IApplication application = wizardModel.getApplication();
- if (application == null) {
- return null;
- }
- return application.getGitUri();
- }
-
- public void loadApplicationUrl() throws OpenShiftException {
- setLoading(true);
- setApplicationUrl("Loading...");
- setApplicationUrl(getApplicationUrl());
- setLoading(false);
- }
-
- public String getApplicationUrl() throws OpenShiftException {
- IApplication application = wizardModel.getApplication();
- if (application == null) {
- return null;
- }
- return application.getApplicationUrl();
- }
-
- public String getApplicationName() {
- IApplication application = wizardModel.getApplication();
- if (application == null) {
- return null;
- }
- return application.getName();
- }
-
- public boolean isJBossAS7Application() {
- IApplication application = wizardModel.getApplication();
- if (application == null) {
- return false;
- }
- return ICartridge.JBOSSAS_7.equals(application.getCartridge());
- }
-
- public void setApplicationUrl(String applicationUrl) {
- firePropertyChange(PROPERTY_APPLICATION_URL, null, applicationUrl);
- }
-
- public String getRepositoryPath() {
- return wizardModel.getRepositoryPath();
- }
-
- public void setRepositoryPath(String repositoryPath) {
- firePropertyChange(PROPERTY_REPO_PATH
- , wizardModel.getRepositoryPath()
- , wizardModel.setRepositoryPath(repositoryPath));
- }
-
- public void resetRepositoryPath() {
- setRepositoryPath(getDefaultRepositoryPath());
- }
-
- private String getDefaultRepositoryPath() {
- return EGitUIUtils.getEGitDefaultRepositoryPath();
- }
-
- public String getRemoteName() {
- return wizardModel.getRemoteName();
- }
-
- public void setRemoteName(String remoteName) {
- firePropertyChange(PROPERTY_REMOTE_NAME
- , wizardModel.getRemoteName()
- , wizardModel.setRemoteName(remoteName));
- }
-
- public void resetRemoteName() {
- setRemoteName(REMOTE_NAME_DEFAULT);
- }
-
- // TODO should this stay?
- public ImportProjectWizardModel getWizardModel() {
- return wizardModel;
- }
-
- public boolean isLoading() {
- return loading;
- }
-
- public void setLoading(boolean loading) {
- firePropertyChange(PROPERTY_LOADING, this.loading, this.loading = loading);
- }
-
- public boolean isCompatibleToApplicationCartridge(ICartridge cartridge) {
- IApplication application = wizardModel.getApplication();
- return application != null
- && application.getCartridge() != null
- && application.getCartridge().equals(cartridge);
- }
-
- public static class GitUri {
-
- private String label;
- private String gitUri;
- private ICartridge cartridge;
-
- private GitUri(String label, String gitUri, ICartridge cartridge) {
- this.label = label;
- this.gitUri = gitUri;
- this.cartridge = cartridge;
- }
-
- public String getLabel() {
- return label;
- }
-
- public String getGitUri() {
- return gitUri;
- }
-
- public String toString() {
- return getLabel();
- }
-
- public ICartridge getCartridge() {
- return cartridge;
- }
-
- public boolean isCompatible(ICartridge cartridge) {
- return this.cartridge.equals(cartridge);
- }
- }
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionDialogModel.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -13,9 +13,7 @@
import java.util.Collections;
import java.util.List;
-import org.eclipse.debug.internal.ui.importexport.launchconfigurations.WizardMessages;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPage.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPage.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,329 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.util.Collection;
-
-import org.eclipse.core.databinding.Binding;
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.UpdateListStrategy;
-import org.eclipse.core.databinding.UpdateValueStrategy;
-import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.MultiValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-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.jface.databinding.fieldassist.ControlDecorationSupport;
-import org.eclipse.jface.databinding.swt.ISWTObservableValue;
-import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.fieldassist.AutoCompleteField;
-import org.eclipse.jface.fieldassist.ControlDecoration;
-import org.eclipse.jface.fieldassist.FieldDecoration;
-import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.common.ui.databinding.InvertingBooleanConverter;
-import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-
-import com.openshift.express.client.Cartridge;
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.ICartridge;
-import com.openshift.express.client.NotFoundOpenShiftException;
-
-/**
- * @author Andre Dietisheim
- * @author Xavier Coulon
- */
-@Deprecated
-public class ApplicationSelectionWizardPage extends AbstractOpenShiftWizardPage {
-
- private TableViewer tableViewer;
- private final ApplicationSelectionWizardPageModel pageModel;
-
- private Text existingAppNameText = null;
-
- public ApplicationSelectionWizardPage(IWizard wizard, IOpenShiftWizardModel wizardModel) {
- super("Application selection", "Click 'next' or select another application to import.",
- "Application selection", wizard);
- this.pageModel = new ApplicationSelectionWizardPageModel(wizardModel);
- }
-
- @Override
- protected void doCreateControls(Composite container, DataBindingContext dbc) {
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);
- createExistingAppSelectionGroup(container, dbc);
- //createApplicationCreationGroup(container, dbc);
- }
-
- private Composite createExistingAppSelectionGroup(Composite container, DataBindingContext dbc) {
- Composite existingAppSelectionGroup = new Composite(container, SWT.NONE);
- // projectGroup.setText("Project");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
- .applyTo(existingAppSelectionGroup);
- GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(existingAppSelectionGroup);
-
- // existing app checkbox
- Button useExistingAppBtn = new Button(existingAppSelectionGroup, SWT.CHECK);
- useExistingAppBtn.setText("Use the existing application");
- useExistingAppBtn.setToolTipText("Select an existing application or uncheck to create a new one.");
- useExistingAppBtn.setFocus();
- GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
- .applyTo(useExistingAppBtn);
- final IObservableValue useExistingAppObservable = BeanProperties.value(
- ApplicationSelectionWizardPageModel.PROPERTY_USE_EXISTING_APPLICATION).observe(pageModel);
- final ISWTObservableValue useExistingAppBtnSelection = WidgetProperties.selection().observe(useExistingAppBtn);
- dbc.bindValue(useExistingAppBtnSelection, useExistingAppObservable);
-
- // existing project
- Label existingProjectLabel = new Label(existingAppSelectionGroup, SWT.NONE);
- existingProjectLabel.setText("Use the existing project");
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(false, false).indent(10, 0)
- .applyTo(existingProjectLabel);
-
- existingAppNameText = new Text(existingAppSelectionGroup, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
- .applyTo(existingAppNameText);
- final IObservableValue appNameModelObservable = BeanProperties.value(
- ApplicationSelectionWizardPageModel.PROPERTY_SELECTED_APPLICATION).observe(pageModel);
- final ISWTObservableValue existingAppNameTextObservable = WidgetProperties.text(SWT.Modify).observe(
- existingAppNameText);
- ValueBindingBuilder.bind(existingAppNameTextObservable).to(appNameModelObservable).in(dbc);
- // disable the project name text when the model state is set to 'new project'
- ValueBindingBuilder.bind(WidgetProperties.enabled().observe(existingAppNameText))
- .notUpdating(useExistingAppObservable).converting(new InvertingBooleanConverter()).in(dbc);
- // move focus to the project name text control when choosing the 'Use an existing project' option.
- useExistingAppBtn.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- existingAppNameText.setFocus();
- existingAppNameText.selectAll();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- // let's provide content assist on the existing project name
- ControlDecoration dec = new ControlDecoration(existingAppNameText, SWT.TOP | SWT.LEFT);
- FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
- dec.setImage(contentProposalFieldIndicator.getImage());
- dec.setDescriptionText("Auto-completion is enabled when you start typing a project name.");
- dec.setShowOnlyOnFocus(true);
-
- AutoCompleteField adapter = new AutoCompleteField(existingAppNameText, new TextContentAdapter(),
- new String[] {});
-
- //adapter.setProposals(getOpenProjectsInWorkspace());
-
- Button browseAppsButton = new Button(existingAppSelectionGroup, SWT.NONE);
- browseAppsButton.setText("Browse");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).span(1, 1).grab(false, false)
- .applyTo(browseAppsButton);
- browseAppsButton.addSelectionListener(onBrowseApps());
- ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseAppsButton))
- .notUpdating(useExistingAppObservable).converting(new InvertingBooleanConverter()).in(dbc);
-
- final IObservableValue existingProjectValidityObservable = BeanProperties.value(
- ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_EXISTING_PROJECT_VALIDITY).observe(pageModel);
- final UseExistingApplicationValidator existingProjectValidator = new UseExistingApplicationValidator(
- existingProjectValidityObservable);
- dbc.addValidationStatusProvider(existingProjectValidator);
- ControlDecorationSupport.create(existingProjectValidator, SWT.LEFT | SWT.TOP);
-
- return existingAppSelectionGroup;
- }
-
- private SelectionListener onBrowseApps() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Creates the SWT Group in which a table which will display the existing applications with their corresponding
- * type. Before each application, a radio button will let the user choose which application to import in his
- * workspace.
- *
- * @param container
- * @param dbc
- */
- private void createApplicationCreationGroup(Composite parent, DataBindingContext dbc) {
- GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).applyTo(parent);
-
- Label nameLabel = new Label(parent, SWT.NONE);
- nameLabel.setText("Na&me");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(nameLabel);
- Text nameText = new Text(parent, SWT.BORDER);
- nameText.setTextLimit(13);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameText);
- Binding nameBinding = dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(nameText),
- BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_NAME).observe(pageModel),
- new UpdateValueStrategy().setAfterGetValidator(new ApplicationNameValidator()), null);
- ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP);
-
- Label cartridgeLabel = new Label(parent, SWT.WRAP);
- cartridgeLabel.setText("&Application Type");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(cartridgeLabel);
- Combo cartridgesCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cartridgesCombo);
- dbc.bindList(WidgetProperties.items().observe(cartridgesCombo),
- BeanProperties.list(NewApplicationWizardPageModel.PROPERTY_CARTRIDGES).observe(pageModel),
- new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER),
- new UpdateListStrategy().setConverter(new Converter(Object.class, String.class) {
-
- @Override
- public Object convert(Object fromObject) {
- if (!(fromObject instanceof ICartridge)) {
- return null;
- }
- return ((ICartridge) fromObject).getName();
- }
- }));
- Binding comboSelectionBinding = dbc.bindValue(WidgetProperties.selection().observe(cartridgesCombo),
- BeanProperties.value(NewApplicationWizardPageModel.PROPERTY_SELECTED_CARTRIDGE).observe(pageModel),
- new UpdateValueStrategy().setConverter(new Converter(String.class, ICartridge.class) {
-
- @Override
- public Object convert(Object fromObject) {
- if (fromObject instanceof String && ((String) fromObject).length() > 0) {
- return new Cartridge(((String) fromObject));
- }
- return null;
- }
- }).setAfterGetValidator(new IValidator() {
-
- @Override
- public IStatus validate(Object value) {
- if (!(value instanceof String) || ((String) value).length() == 0) {
- return ValidationStatus.error("You have to select a type");
- } else {
- return ValidationStatus.ok();
- }
- }
- }), new UpdateValueStrategy().setConverter(new Converter(ICartridge.class, String.class) {
-
- @Override
- public Object convert(Object fromObject) {
- if (fromObject instanceof ICartridge) {
- return ((ICartridge) fromObject).getName();
- }
- return null;
- }
- }));
- ControlDecorationSupport.create(comboSelectionBinding, SWT.LEFT | SWT.TOP);
-
- }
-
- private SelectionAdapter onRefresh(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- try {
- WizardUtils.runInWizard(new Job("Loading applications...") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return Status.OK_STATUS;
- }
-
- }, getContainer(), getDataBindingContext());
-
- } catch (Exception e) {
- // ignore
- }
- }
- };
- }
-
- @Override
- protected void onPageActivated(final DataBindingContext dbc) {
- try {
- WizardUtils.runInWizard(new Job("Loading applications...") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- final Collection<IApplication> applications = pageModel.getApplications();
- return Status.OK_STATUS;
- } catch (NotFoundOpenShiftException e) {
- // no domain and therefore no applications present
- return Status.OK_STATUS;
- } catch (Exception e) {
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, "Could not load applications",
- e);
- }
- }
-
- }, getContainer(), getDataBindingContext());
-
- } catch (Exception ex) {
- // ignore
- }
- }
-
- class UseExistingApplicationValidator extends MultiValidator {
-
- private final IObservableValue existingProjectValidityObservable;
-
- public UseExistingApplicationValidator(IObservableValue existingProjectValidityObservable) {
- this.existingProjectValidityObservable = existingProjectValidityObservable;
- }
-
- @Override
- protected IStatus validate() {
- final IStatus existingProjectValidityStatus = (IStatus) existingProjectValidityObservable.getValue();
-
- if (existingProjectValidityStatus != null) {
- final IStatus existingProjectValidity = pageModel.getExistingApplicationValidity();
- return existingProjectValidity;
- }
- return ValidationStatus.ok();
- }
-
- }
-
- private class ApplicationNameValidator implements IValidator {
-
- @Override
- public IStatus validate(Object value) {
- String name = (String) value;
- if (name.length() == 0) {
- return ValidationStatus.error("You have to provide a name");
- } else if (pageModel.hasApplication(name)) {
- return ValidationStatus.error(NLS.bind(
- "Names must be unique. You already have an application named \"{0}\"", name));
- }
- return ValidationStatus.ok();
- }
- }
-
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPageModel.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationSelectionWizardPageModel.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author Andre Dietisheim
- * @author Xavier Coulon
- *
- */
-@Deprecated
-public class ApplicationSelectionWizardPageModel extends ObservableUIPojo {
-
- public static final String PROPERTY_USE_EXISTING_APPLICATION = "useExistingApplication";
- public static final String PROPERTY_SELECTED_APPLICATION = "selectedApplication";
-
- private boolean useExistingApplication = false;
- private IApplication selectedApplication;
- private IOpenShiftWizardModel wizardModel;
-
- public ApplicationSelectionWizardPageModel(IOpenShiftWizardModel wizardModel) {
- this.wizardModel = wizardModel;
- this.selectedApplication = wizardModel.getApplication();
- this.useExistingApplication = wizardModel.isExistingApplication();
- }
-
- public List<IApplication> getApplications() throws OpenShiftException {
- IUser user = getUser();
- if (user == null) {
- return Collections.emptyList();
- }
- return user.getApplications();
- }
-
- public IApplication getSelectedApplication() {
- return selectedApplication;
- }
-
- public void setSelectedApplication(IApplication application) {
- wizardModel.setApplication(application);
- firePropertyChange(PROPERTY_SELECTED_APPLICATION, this.selectedApplication, this.selectedApplication = application);
- }
-
- public IUser getUser() {
-// return OpenShiftUIActivator.getDefault().getUser();
- return wizardModel.getUser();
- }
-
- public boolean getUseExistingApplication() {
- return this.useExistingApplication;
- }
-
- public void setUseExistingApplication(boolean useExistingApplication) {
- wizardModel.setUseExistingApplication(useExistingApplication);
- firePropertyChange(PROPERTY_USE_EXISTING_APPLICATION, this.useExistingApplication, this.useExistingApplication = useExistingApplication);
-
- }
- public IStatus getExistingApplicationValidity() {
- // TODO Auto-generated method stub
- return Status.OK_STATUS;
- }
-
- public boolean hasApplication(String name) {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,413 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-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.conversion.Converter;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-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.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.databinding.viewers.ViewerProperties;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.common.ui.databinding.DataBindingUtils;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IDomain;
-import com.openshift.express.client.NotFoundOpenShiftException;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim
- */
-public class ApplicationWizardPage extends AbstractOpenShiftWizardPage {
-
- private TableViewer viewer;
- private ApplicationWizardPageModel model;
- private ImportProjectWizardModel wizardModel;
-
- public ApplicationWizardPage(IWizard wizard, ImportProjectWizardModel wizardModel) {
- super("Application selection", "Please select an application to start with or create a new one.",
- "Application selection", wizard);
- this.wizardModel = wizardModel;
- this.model = new ApplicationWizardPageModel(wizardModel);
- }
-
- @Override
- protected void doCreateControls(Composite container, DataBindingContext dbc) {
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(container);
-
- createDomainGroup(container, dbc);
- createApplicationsGroup(container, dbc);
- }
-
- private void createDomainGroup(Composite container, DataBindingContext dbc) {
- Group domainGroup = new Group(container, SWT.BORDER);
- domainGroup.setText("Domain");
- GridDataFactory.fillDefaults()
- .grab(true, false).align(SWT.FILL, SWT.TOP).span(3, 1).applyTo(domainGroup);
- GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(4).applyTo(domainGroup);
- Label namespaceLabel = new Label(domainGroup, SWT.NONE);
- namespaceLabel.setText("&Domain name");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(namespaceLabel);
- Text namespaceText = new Text(domainGroup, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(namespaceText);
- Binding namespaceBinding = DataBindingUtils.bindMandatoryTextField(
- namespaceText, "Domain", ApplicationWizardPageModel.PROPERTY_NAMESPACE, model, dbc);
- Button createRenameButton = new Button(domainGroup, SWT.PUSH);
- DataBindingUtils.bindEnablementToValidationStatus(createRenameButton, IStatus.OK, dbc, namespaceBinding);
- dbc.bindValue(WidgetProperties.text().observe(createRenameButton)
- , BeanProperties.value(ApplicationWizardPageModel.PROPERTY_DOMAIN).observe(model)
- , new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)
- , new UpdateValueStrategy().setConverter(new Converter(IDomain.class, String.class) {
-
- @Override
- public Object convert(Object fromObject) {
- if (fromObject instanceof IDomain) {
- return "&Rename";
- } else {
- return "&Create";
- }
- }
- }));
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(80, SWT.DEFAULT).applyTo(createRenameButton);
- createRenameButton.addSelectionListener(onCreateRenameDomain(dbc));
- }
-
- private void createApplicationsGroup(Composite container, DataBindingContext dbc) {
- Group applicationGroup = new Group(container, SWT.BORDER);
- applicationGroup.setText("Available Applications");
- GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(3, 1)
- .applyTo(applicationGroup);
- GridLayoutFactory.fillDefaults().numColumns(4).margins(6, 6).applyTo(applicationGroup);
-
- Composite tableContainer = new Composite(applicationGroup, SWT.NONE);
- this.viewer = createTable(tableContainer);
- GridDataFactory.fillDefaults().span(4, 1).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableContainer);
- viewer.addDoubleClickListener(onApplicationDoubleClick());
- Binding selectedApplicationBinding = dbc.bindValue(
- ViewerProperties.singleSelection().observe(viewer),
- BeanProperties.value(ApplicationWizardPageModel.PROPERTY_SELECTED_APPLICATION).observe(model),
- new UpdateValueStrategy().setAfterGetValidator(new IValidator() {
-
- @Override
- public IStatus validate(Object value) {
- if (value != null) {
- return ValidationStatus.ok();
- }
- else {
- return ValidationStatus
- .info("Please select an application to start with, or create a new one");
- }
- }
- }),
- null);
-
- Button newButton = new Button(applicationGroup, SWT.PUSH);
- newButton.setText("Ne&w");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, SWT.DEFAULT).applyTo(newButton);
- newButton.addSelectionListener(onNew(dbc));
-
- Button deleteButton = new Button(applicationGroup, SWT.PUSH);
- deleteButton.setText("&Delete");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, SWT.DEFAULT).applyTo(deleteButton);
- DataBindingUtils.bindEnablementToValidationStatus(deleteButton, IStatus.OK, dbc, selectedApplicationBinding);
- deleteButton.addSelectionListener(onDelete(dbc));
-
- Button embedButton = new Button(applicationGroup, SWT.PUSH);
- embedButton.setText("E&dit");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(80, SWT.DEFAULT).applyTo(embedButton);
- DataBindingUtils.bindEnablementToValidationStatus(embedButton, IStatus.OK, dbc, selectedApplicationBinding);
- embedButton.addSelectionListener(onEmbed(dbc));
-
- Button detailsButton = new Button(applicationGroup, SWT.PUSH);
- detailsButton.setText("De&tails");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).grab(true, false).hint(80, SWT.DEFAULT)
- .applyTo(detailsButton);
- DataBindingUtils.bindEnablementToValidationStatus(detailsButton, IStatus.OK, dbc, selectedApplicationBinding);
- detailsButton.addSelectionListener(onDetails(dbc));
- }
-
- private SelectionListener onCreateRenameDomain(DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (model.hasDomain()) {
- renameDomain();
- } else {
- try {
- createDomain();
- } catch (OpenShiftException ex) {
- IStatus status = new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, ex.getMessage(), ex);
- OpenShiftUIActivator.getDefault().getLog().log(status);
- ErrorDialog.openError(getShell(), "Error creating domain",
- "An error occurred while creating the domain.", status);
- }
- }
- }
- };
- }
-
- private void createDomain() throws OpenShiftException {
- if (WizardUtils.openWizardDialog(
- new NewDomainDialog(wizardModel.getUser()), getContainer().getShell()) == Dialog.OK) {
- model.loadDomain();
- }
- }
-
- private void renameDomain() {
- try {
- WizardUtils.runInWizard(
- new Job("Renaming domain...") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- model.renameDomain();
- return Status.OK_STATUS;
- } catch (Exception e) {
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "Could not rename domain", e);
- }
- }
- }, getContainer(), getDataBindingContext());
- } catch (Exception ex) {
- // ignore
- }
- }
-
- private IDoubleClickListener onApplicationDoubleClick() {
- return new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- openDetailsDialog();
- }
- };
- }
-
- protected TableViewer createTable(Composite tableContainer) {
- Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
- GridDataFactory.fillDefaults().grab(true, true).applyTo(table);
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableContainer.setLayout(tableLayout);
- TableViewer viewer = new TableViewer(table);
- viewer.setContentProvider(new ArrayContentProvider());
-
- createTableColumn("Name", 1, new CellLabelProvider() {
-
- @Override
- public void update(ViewerCell cell) {
- IApplication application = (IApplication) cell.getElement();
- cell.setText(application.getName());
- }
- }, viewer, tableLayout);
- createTableColumn("Type", 1, new CellLabelProvider() {
-
- @Override
- public void update(ViewerCell cell) {
- IApplication application = (IApplication) cell.getElement();
- cell.setText(application.getCartridge().getName());
- }
- }, viewer, tableLayout);
- return viewer;
- }
-
- private void createTableColumn(String name, int weight, CellLabelProvider cellLabelProvider, TableViewer viewer,
- TableColumnLayout layout) {
- TableViewerColumn column = new TableViewerColumn(viewer, SWT.LEFT);
- column.getColumn().setText(name);
- column.setLabelProvider(cellLabelProvider);
-
- layout.setColumnData(column.getColumn(), new ColumnWeightData(weight, true));
- }
-
- private SelectionAdapter onDelete(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- if (MessageDialog
- .openQuestion(
- getShell(),
- "Delete Application",
- NLS.bind(
- "This action will permanently remove the application and all of its data. The data cannot be recovered. "
- + "Are you sure that you want to delete application '{0}' ?",
- model.getSelectedApplication().getName()))) {
- WizardUtils.runInWizard(
- new Job(NLS.bind("Deleting application \"{0}\"...",
- model.getSelectedApplication().getName())) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- model.destroyCurrentApplication();
- final Collection<IApplication> applications = model.getApplications();
- setViewerInput(applications);
- return Status.OK_STATUS;
- } catch (OpenShiftException e) {
- return OpenShiftUIActivator.createErrorStatus(
- NLS.bind("Could not delete application \"{0}\"",
- model.getSelectedApplication().getName())
- , e);
- }
- }
- }, getContainer(), dbc);
- }
- } catch (Exception ex) {
- // ignore
- }
- }
- };
- }
-
- private SelectionAdapter onNew(DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Shell shell = getContainer().getShell();
- NewApplicationWizard applicationDialog = new NewApplicationWizard(model.getUser());
- if (WizardUtils.openWizardDialog(applicationDialog, shell) == Dialog.OK) {
- try {
- final Collection<IApplication> applications = model.getApplications();
- setViewerInput(applications);
- model.setSelectedApplication(applicationDialog.getApplication());
- } catch (OpenShiftException ex) {
- Logger.error(NLS.bind("Could not delete application \"{0}\"",
- model.getSelectedApplication().getName()), ex);
- }
- }
- }
- };
- }
-
- private SelectionAdapter onEmbed(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- WizardUtils.openWizardDialog(
- new EmbedCartridgeWizard(model.getSelectedApplication(), model.getUser()), getShell());
- try {
- final Collection<IApplication> applications = model.getApplications();
- setViewerInput(applications);
- } catch (OpenShiftException ex) {
- Logger.error(NLS.bind("Could not load the availabel applications", ex));
- }
- }
- };
- }
-
- private SelectionAdapter onDetails(DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- openDetailsDialog();
- }
- };
- }
-
- private void openDetailsDialog() {
- new ApplicationDetailsDialog(model.getSelectedApplication(), getShell()).open();
- }
-
- @Override
- protected void onPageActivated(final DataBindingContext dbc) {
- try {
- WizardUtils.runInWizard(new Job("Loading applications...") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- model.loadDomain();
- final Collection<IApplication> applications = model.getApplications();
- setViewerInput(applications);
- return Status.OK_STATUS;
- } catch (NotFoundOpenShiftException e) {
- // no domain and therefore no applications present
- clearViewer();
- return Status.OK_STATUS;
- } catch (Exception e) {
- clearViewer();
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "Could not load applications", e);
- }
- }
-
- }, getContainer(), getDataBindingContext());
-
- } catch (Exception ex) {
- // ignore
- }
- }
-
- private void clearViewer() {
- Logger.debug("Clearing applications list in viewer");
- setViewerInput(new ArrayList<IApplication>());
- }
-
- private void setViewerInput(final Collection<IApplication> applications) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- Logger.debug("Setting {} application(s) in the viewer", applications.size());
- viewer.setInput(applications);
- }
- });
- }
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPageModel.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ImportProjectWizardModel;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IDomain;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim
- *
- */
-public class ApplicationWizardPageModel extends ObservableUIPojo {
-
- public static final String PROPERTY_NAMESPACE = "namespace";
- public static final String PROPERTY_DOMAIN = "domain";
- public static final String PROPERTY_SELECTED_APPLICATION = "selectedApplication";
-
- private String namespace;
- private IDomain domain;
- private IApplication selectedApplication;
- private ImportProjectWizardModel wizardModel;
-
- public ApplicationWizardPageModel(ImportProjectWizardModel wizardModel) {
- this.wizardModel = wizardModel;
- }
-
- public String getNamespace() {
- return this.namespace;
- }
-
- private void setNamespace(IDomain domain) {
- if (domain != null) {
- setNamespace(domain.getNamespace());
- } else {
- setNamespace((String) null);
- }
- }
-
- public void setNamespace(String namespace) {
- firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
- }
-
- public boolean hasDomain() {
- return domain != null;
- }
-
- public IDomain getDomain() {
- return domain;
- }
-
- public void setDomain(IDomain domain) {
- firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
- setNamespace(domain);
- }
-
- public void renameDomain() throws OpenShiftException {
- getDomain().setNamespace(namespace);
- }
-
- public void loadDomain() throws OpenShiftException {
- setDomain(getUser().getDomain());
- }
-
- public List<IApplication> getApplications() throws OpenShiftException {
- IUser user = getUser();
- if (user == null) {
- return Collections.emptyList();
- }
- return user.getApplications();
- }
-
- public IApplication getSelectedApplication() {
- return selectedApplication;
- }
-
- public void setSelectedApplication(IApplication application) {
- wizardModel.setApplication(application);
- firePropertyChange(PROPERTY_SELECTED_APPLICATION, this.selectedApplication, this.selectedApplication = application);
- }
-
- public void destroyCurrentApplication() throws OpenShiftException {
- if (selectedApplication == null) {
- return;
- }
-
- selectedApplication.destroy();
- }
-
- public IUser getUser() {
- return wizardModel.getUser();
- }
-
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -48,7 +48,7 @@
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(namespaceLabel);
Text namespaceText = new Text(domainGroup, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(namespaceText);
- DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain", ApplicationWizardPageModel.PROPERTY_NAMESPACE,
+ DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain", EditDomainWizardPageModel.PROPERTY_NAMESPACE,
model, dbc);
}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard.appimport;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jgit.api.errors.JGitInternalException;
-import org.eclipse.jgit.errors.TransportException;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.common.ui.DelegatingProgressMonitor;
-import org.jboss.tools.common.ui.JobUtils;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
-import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPage;
-import org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationWizardPage;
-import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizard;
-
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim
- * @Deprecated: see {@link OpenShiftExpressApplicationWizard}
- */
-@Deprecated
-public class ImportProjectWizard extends Wizard implements INewWizard {
-
- private ImportProjectWizardModel model;
-
- public ImportProjectWizard() {
- }
-
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- setWindowTitle("OpenShift application wizard");
- setNeedsProgressMonitor(true);
- }
-
- @Override
- public boolean performFinish() {
- try {
- final DelegatingProgressMonitor delegatingMonitor = new DelegatingProgressMonitor();
- IStatus jobResult = WizardUtils.runInWizard(
- new ImportJob(delegatingMonitor),
- delegatingMonitor, getContainer());
- return JobUtils.isOk(jobResult);
- } catch (Exception e) {
- ErrorDialog.openError(getShell(), "Error", "Could not create local git repository.",
- new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "An exception occurred while creating local git repository.", e));
- return false;
- }
- }
-
- private boolean askForConfirmation(final String message, final String applicationName) {
- final boolean[] confirmed = new boolean[1];
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- confirmed[0] = MessageDialog.openConfirm(
- getShell(),
- NLS.bind("Import OpenShift Application ", applicationName),
- message);
- }
- });
- return confirmed[0];
- }
-
- @Override
- public void addPages() {
- this.model = new ImportProjectWizardModel();
- //addPage(new CredentialsWizardPage(this, model));
- addPage(new ApplicationWizardPage(this, model));
- addPage(new AdapterWizardPage(this, model));
- }
-
- private boolean isTransportException(InvocationTargetException e) {
- return e.getTargetException() instanceof JGitInternalException
- && e.getTargetException().getCause() instanceof TransportException;
- }
-
- private TransportException getTransportException(InvocationTargetException e) {
- if (isTransportException(e)) {
- return (TransportException) ((JGitInternalException) e.getTargetException()).getCause();
- }
- return null;
- }
-
- /**
- * A workspace job that will create a new project or enable the selected
- * project to be used with OpenShift.
- */
- private class ImportJob extends WorkspaceJob {
-
- private DelegatingProgressMonitor delegatingMonitor;
-
- public ImportJob(DelegatingProgressMonitor delegatingMonitor) {
- super("Importing project to workspace...");
- this.delegatingMonitor = delegatingMonitor;
- }
-
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- try {
- delegatingMonitor.add(monitor);
-
- if (model.isNewProject()) {
- model.importProject(delegatingMonitor);
- } else if (!model.isGitSharedProject()) {
- if (!askForConfirmation(
- NLS.bind("OpenShift application {0} will be enabled on project {1} by " +
- "copying OpenShift configuration and enabling Git for the project.\n " +
- "This cannot be undone. Do you wish to continue ?",
- model.getApplicationName(), model.getProjectName()),
- model.getApplicationName())) {
- return Status.CANCEL_STATUS;
- }
- model.configureUnsharedProject(delegatingMonitor);
- } else {
- if (!askForConfirmation(
- NLS.bind("OpenShift application {0} will be enabled on project {1} by copying OpenShift " +
- "configuration and adding the OpenShift git repo as remote.\n " +
- "This cannot be undone. Do you wish to continue ?",
- model.getApplicationName(), model.getProjectName()),
- model.getApplicationName())) {
- return Status.CANCEL_STATUS;
- }
- model.configureGitSharedProject(delegatingMonitor);
- }
-
- return Status.OK_STATUS;
- } catch (final WontOverwriteException e) {
- openError("Project already present", e.getMessage());
- return Status.CANCEL_STATUS;
- } catch (final ImportFailedException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not import maven project {0}.", e,
- model.getProjectName());
- } catch (IOException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not copy openshift configuration files to project {0}", e,
- model.getProjectName());
- } catch (OpenShiftException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not import project to the workspace.", e);
- } catch (URISyntaxException e) {
- return OpenShiftUIActivator.createErrorStatus(
- "The url of the remote git repository is not valid", e);
- } catch (InvocationTargetException e) {
- if (isTransportException(e)) {
- TransportException te = getTransportException(e);
- return OpenShiftUIActivator
- .createErrorStatus(
- "Could not clone the repository. Authentication failed.\n"
- + " Please make sure that you added your private key to the ssh preferences.",
- te);
- } else {
- return OpenShiftUIActivator.createErrorStatus(
- "An exception occurred while creating local git repository.", e);
- }
- } catch (Exception e) {
- return OpenShiftUIActivator.createErrorStatus(
- "Could not import project to the workspace.", e);
- } finally {
- delegatingMonitor.done();
- }
- }
- }
-
- private void openError(final String title, final String message) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- MessageDialog.openError(getShell(), title, message);
- }
- });
- }
-
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-14 14:03:44 UTC (rev 38698)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-14 14:22:47 UTC (rev 38699)
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard.appimport;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerType;
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.egit.core.EGitUtils;
-import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPageModel;
-import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizardModel;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.ICartridge;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author André Dietisheim <adietish(a)redhat.com>
- * @Deprecated: see {@link OpenShiftExpressApplicationWizardModel}
- */
-@Deprecated
-public class ImportProjectWizardModel extends ObservableUIPojo {
-
- private HashMap<String, Object> dataModel = new HashMap<String, Object>();
-
- public static final String NEW_PROJECT = "enableProject";
- public static final String USER = "user";
- public static final String APPLICATION = "application";
- public static final String REMOTE_NAME = "remoteName";
- public static final String REPOSITORY_PATH = "repositoryPath";
- public static final String PROJECT_NAME = "projectName";
- public static final String MERGE_URI = "mergeUri";
- public static final String RUNTIME_DELEGATE = "runtimeDelegate";
- public static final String CREATE_SERVER = "createServer";
-
- public ImportProjectWizardModel() {
- dataModel.put(NEW_PROJECT, false);
- }
-
- /**
- * Imports the project that the user has chosen into the workspace.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws OpenShiftException
- * @throws CoreException
- * @throws InterruptedException
- * @throws URISyntaxException
- * @throws InvocationTargetException
- * @throws IOException
- */
- public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
- URISyntaxException, InvocationTargetException, IOException {
- List<IProject> importedProjects = new ImportNewProject(getProjectName()
- , getApplication()
- , getRemoteName()
- , getRepositoryFile())
- .execute(monitor);
- createServerAdapter(monitor, importedProjects);
- }
-
- /**
- * Enables the user chosen, unshared project to be used on the chosen
- * OpenShift application. Clones the application git repository, copies the
- * configuration files to the user project (in the workspace), shares the
- * user project with git and creates the server adapter.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws URISyntaxException
- * The OpenShift application repository could not be cloned,
- * because the uri it is located at is not a valid git uri
- * @throws OpenShiftException
- *
- * @throws InvocationTargetException
- * The OpenShift application repository could not be cloned, the
- * clone operation failed.
- * @throws InterruptedException
- * The OpenShift application repository could not be cloned, the
- * clone operation was interrupted.
- * @throws IOException
- * The configuration files could not be copied from the git
- * clone to the user project
- * @throws CoreException
- * The user project could not be shared with the git
- */
- public void configureUnsharedProject(IProgressMonitor monitor)
- throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
- URISyntaxException {
- List<IProject> importedProjects = new ConfigureUnsharedProject(
- getProjectName()
- , getApplication()
- , getRemoteName()
- , getUser())
- .execute(monitor);
- createServerAdapter(monitor, importedProjects);
- }
-
- /**
- * Enables the user chosen, unshared project to be used on the chosen
- * OpenShift application. Clones the application git repository, copies the
- * configuration files to the user project (in the workspace), adds the
- * appication git repo as remote and creates the server adapter.
- *
- * @param monitor
- * the monitor to report progress to
- * @throws URISyntaxException
- * The OpenShift application repository could not be cloned,
- * because the uri it is located at is not a valid git uri
- * @throws OpenShiftException
- *
- * @throws InvocationTargetException
- * The OpenShift application repository could not be cloned, the
- * clone operation failed.
- * @throws InterruptedException
- * The OpenShift application repository could not be cloned, the
- * clone operation was interrupted.
- * @throws IOException
- * The configuration files could not be copied from the git
- * clone to the user project
- * @throws CoreException
- * The user project could not be shared with the git
- */
- public void configureGitSharedProject(IProgressMonitor monitor)
- throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
- URISyntaxException {
- List<IProject> importedProjects = new ConfigureGitSharedProject(
- getProjectName()
- , getApplication()
- , getRemoteName()
- , getUser())
- .execute(monitor);
- createServerAdapter(monitor, importedProjects);
- }
-
- private void createServerAdapter(IProgressMonitor monitor, List<IProject> importedProjects)
- throws OpenShiftException {
- Assert.isTrue(importedProjects.size() > 0);
- IProject project = importedProjects.get(0);
- //new ServerAdapterFactory().create(project, this, monitor);
- }
-
- public File getRepositoryFile() {
- String repositoryPath = getRepositoryPath();
- if (repositoryPath == null
- || repositoryPath.length() == 0) {
- return null;
- }
- return new File(repositoryPath, getApplicationName());
- }
-
- public Object setProperty(String key, Object value) {
- Object oldVal = dataModel.get(key);
- dataModel.put(key, value);
- firePropertyChange(key, oldVal, value);
- return value;
- }
-
- public Object getProperty(String key) {
- return dataModel.get(key);
- }
-
- public void setUser(IUser user) {
- setProperty(USER, user);
- }
-
- public IUser getUser() {
- return (IUser) getProperty(USER);
- }
-
- public IApplication getApplication() {
- return (IApplication) getProperty(APPLICATION);
- }
-
- public String getApplicationName() {
- String applicationName = null;
- IApplication application = getApplication();
- if (application != null) {
- applicationName = application.getName();
- }
- return applicationName;
- }
-
- public ICartridge getApplicationCartridge() {
- ICartridge cartridge = null;
- IApplication application = getApplication();
- if (application != null) {
- cartridge = application.getCartridge();
- }
- return cartridge;
- }
-
- public String getApplicationCartridgeName() {
- String cartridgeName = null;
- ICartridge cartridge = getApplicationCartridge();
- if (cartridge != null) {
- cartridgeName = cartridge.getName();
- }
- return cartridgeName;
- }
-
- public void setApplication(IApplication application) {
- setProperty(APPLICATION, application);
- }
-
- public String setRemoteName(String remoteName) {
- setProperty(REMOTE_NAME, remoteName);
- return remoteName;
- }
-
- public String getRemoteName() {
- return (String) getProperty(REMOTE_NAME);
- }
-
- public String setRepositoryPath(String repositoryPath) {
- return (String) setProperty(REPOSITORY_PATH, repositoryPath);
- }
-
- public String getRepositoryPath() {
- return (String) getProperty(REPOSITORY_PATH);
- }
-
- public boolean isNewProject() {
- return (Boolean) getProperty(NEW_PROJECT);
- }
-
- public boolean isGitSharedProject() {
- return EGitUtils.isSharedWithGit(getProject());
- }
-
- private IProject getProject() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- }
-
- public Boolean setNewProject(boolean newProject) {
- return (Boolean) setProperty(NEW_PROJECT, newProject);
- }
-
- public String setProjectName(String projectName) {
- return (String) setProperty(PROJECT_NAME, projectName);
- }
-
- public String getProjectName() {
- return (String) getProperty(PROJECT_NAME);
- }
-
- public String setMergeUri(String mergeUri) {
- return (String) setProperty(MERGE_URI, mergeUri);
- }
-
- public String getMergeUri() {
- return (String) getProperty(MERGE_URI);
- }
-
- public IServerType getServerType() {
- return (IServerType) getProperty(AdapterWizardPageModel.SERVER_TYPE);
- }
-
- public IRuntime getRuntime() {
- return (IRuntime) getProperty(RUNTIME_DELEGATE);
- }
-
- public String getMode() {
- return (String) getProperty(AdapterWizardPageModel.MODE);
- }
-
- public boolean isCreateServer() {
- Boolean isCreateServer = (Boolean) getProperty(CREATE_SERVER);
- return isCreateServer != null
- && isCreateServer.booleanValue();
- }
-}
14 years, 1 month
JBoss Tools SVN: r38698 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-14 09:03:44 -0500 (Tue, 14 Feb 2012)
New Revision: 38698
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
Log:
Fixed missing constructor
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-14 14:01:11 UTC (rev 38697)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-14 14:03:44 UTC (rev 38698)
@@ -57,6 +57,15 @@
* @see #getUser which calls UserModel#getRecentUser if no user present at
* construction time
*/
+ public OpenShiftExpressApplicationWizard() {
+ this(null, null, null, null);
+ }
+
+
+ /**
+ * @see #getUser which calls UserModel#getRecentUser if no user present at
+ * construction time
+ */
public OpenShiftExpressApplicationWizard(String wizardTitle) {
this(null, null, null, wizardTitle);
}
14 years, 1 month
JBoss Tools SVN: r38697 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui: src/org/jboss/tools/openshift/express/internal/ui/action and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-14 09:01:11 -0500 (Tue, 14 Feb 2012)
New Revision: 38697
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserActionDelegate.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizardModel.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
Log:
Fixed JBIDE-10845 Application configuration UI issues JBIDE-10851 title of application configuration is misleading
https://issues.jboss.org/browse/JBIDE-10851
And restoring the "Refresh" button on the 'OpenShift Express Console' view
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-02-14 14:01:11 UTC (rev 38697)
@@ -484,14 +484,14 @@
<viewContribution
id="org.jboss.tools.openshift.express.ui.viewer.expressConsoleViewContribution"
targetID="org.jboss.tools.openshift.express.ui.viewer.expressConsoleView">
- <!--action
- class="org.jboss.tools.openshift.express.internal.ui.viewer.RefreshDomainAction"
+ <action
+ class="org.jboss.tools.openshift.express.internal.ui.action.RefreshUserActionDelegate"
icon="icons/refresh.gif"
id="org.jboss.tools.openshift.express.ui.viewActions.refreshAction"
label="Refresh"
style="push"
toolbarPath="openshift">
- </action-->
+ </action>
<action
class="org.jboss.tools.openshift.express.internal.ui.action.OpenConnectionDialogActionDelegate"
icon="icons/resource_obj.gif"
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -29,7 +29,7 @@
Object sel = ((ITreeSelection)selection).getFirstElement();
if( sel instanceof IUser) {
IUser user = (IUser) sel;
- OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard(user);
+ OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard(user, "New OpenShift Application");
new WizardDialog(new Shell(), wizard).open();
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -41,7 +41,7 @@
final IApplication application = (IApplication) treeSelection.getFirstElement();
final IUser user = getUser(treeSelection.getPaths());
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(application.getName());
- OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard(user, project, application);
+ OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard(user, project, application, "Import");
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.create();
dialog.open();
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshDomainAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshDomainAction.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshDomainAction.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -1,28 +0,0 @@
-package org.jboss.tools.openshift.express.internal.ui.action;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-public class RefreshDomainAction implements IViewActionDelegate {
-
- @Override
- public void run(IAction action) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void init(IViewPart view) {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserAction.java (from rev 38653, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshDomainAction.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserAction.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserAction.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -0,0 +1,28 @@
+package org.jboss.tools.openshift.express.internal.ui.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+public class RefreshUserAction implements IViewActionDelegate {
+
+ @Override
+ public void run(IAction action) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(IViewPart view) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserActionDelegate.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserActionDelegate.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserActionDelegate.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -0,0 +1,50 @@
+package org.jboss.tools.openshift.express.internal.ui.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.navigator.CommonNavigator;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.openshift.express.internal.core.console.UserModel;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.viewer.ConnectToOpenShiftWizard;
+
+public class RefreshUserActionDelegate implements IViewActionDelegate {
+
+ private CommonNavigator view;
+
+ private ISelection selection;
+
+ @Override
+ public void run(IAction action) {
+ final Display display = Display.getCurrent();
+ final Shell shell = new Shell(display);
+ final IWizard connectToOpenShiftWizard = new ConnectToOpenShiftWizard();
+ int returnCode = WizardUtils.openWizardDialog(connectToOpenShiftWizard, shell);
+ if (returnCode == Window.OK) {
+ Logger.debug("OpenShift Auth succeeded.");
+ if (view != null) {
+ view.getCommonViewer().setInput(UserModel.getDefault());
+ }
+ }
+
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ @Override
+ public void init(IViewPart view) {
+ if (view instanceof CommonNavigator) {
+ this.view = (CommonNavigator) view;
+ }
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/RefreshUserActionDelegate.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -241,7 +241,7 @@
if( verifyButton != null ) {
importLink.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
- OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard();
+ OpenShiftExpressApplicationWizard wizard = new OpenShiftExpressApplicationWizard("Import");
wizard.setInitialUser(fuser);
wizard.setSelectedApplication(fapplication);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -100,8 +100,8 @@
private Text newApplicationNameText;
public ApplicationConfigurationWizardPage(IWizard wizard, OpenShiftExpressApplicationWizardModel wizardModel) {
- super("Application Configuration", "Configure the application you want\nto create or import.",
- "Application configuration", wizard);
+ super("Setup OpenShift Application", "Select an existing or create a new OpenShift Express Application.",
+ "Setup OpenShift Application", wizard);
this.pageModel = new ApplicationConfigurationWizardPageModel(wizardModel);
}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizard.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizard.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.openshift.express.internal.ui.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-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.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.common.ui.DelegatingProgressMonitor;
-import org.jboss.tools.common.ui.JobUtils;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.IEmbeddableCartridge;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-/**
- * @author Andre Dietisheim
- * @author Xavier Coulon
- */
-@Deprecated
-public class CreateNewApplicationWizard extends OpenShiftExpressApplicationWizard
- implements INewWizard {
-
- public CreateNewApplicationWizard() {
- setWizardModel(new OpenShiftExpressApplicationWizardModel());
- setNeedsProgressMonitor(true);
- }
-
- @Override
- public void addPages() {
- final IUser user = OpenShiftUIActivator.getDefault().getUser();
- try {
- if (user == null
- || !user.isValid()) {
- addPage(new CredentialsWizardPage(this));
- }
- } catch (OpenShiftException e) {
- // if the user's validity can't be checked, we may want to
- // re-connect..
- addPage(new CredentialsWizardPage(this));
- }
- addPage(new ApplicationConfigurationWizardPage(this, getWizardModel()));
- addPage(new ProjectAndServerAdapterSettingsWizardPage(this, getWizardModel()));
- addPage(new GitCloningSettingsWizardPage(this, getWizardModel()));
- }
-
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean performFinish() {
- boolean successfull = true;
- if (getWizardModel().getApplication() == null) {
- successfull = processApplicationCreation();
-
- }
- if (successfull) {
- successfull = processCartridges();
- }
- if (successfull) {
- try {
- final DelegatingProgressMonitor delegatingMonitor = new DelegatingProgressMonitor();
- IStatus jobResult = WizardUtils.runInWizard(
- new ImportJob(delegatingMonitor), delegatingMonitor, getContainer());
- return JobUtils.isOk(jobResult);
- } catch (Exception e) {
- ErrorDialog.openError(getShell(), "Error", "Could not create local git repository.",
- new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID,
- "An exception occurred while creating local git repository.", e));
- return false;
- }
- }
- return successfull;
- }
-
- private boolean processApplicationCreation() {
- final ArrayBlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
- try {
- WizardUtils.runInWizard(
- new Job(NLS.bind("Creating application \"{0}\"...", getWizardModel().getApplicationName())) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- getWizardModel().createApplication(monitor);
- queue.offer(true);
- return Status.OK_STATUS;
- } catch (Exception e) {
- // TODO: refresh user
- queue.offer(false);
- return OpenShiftUIActivator.createErrorStatus(
- "Could not create application \"{0}\"", e, getWizardModel()
- .getApplicationName());
- }
- }
-
- }, getContainer());
- return queue.poll(10, TimeUnit.SECONDS);
- } catch (Exception e) {
- return false;
- }
- }
-
- private boolean processCartridges() {
- final ArrayBlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
- try {
- WizardUtils.runInWizard(
- new Job(NLS.bind("Adding selected embedded cartridges for application {0}...", getWizardModel()
- .getApplication().getName())) {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
-
- Set<IEmbeddableCartridge> selectedCartridges =
- getWizardModel().getSelectedEmbeddableCartridges();
- final IApplication application = getWizardModel().getApplication();
- if (selectedCartridges != null
- && !selectedCartridges.isEmpty()) {
- List<IEmbeddableCartridge> list = new ArrayList<IEmbeddableCartridge>();
- list.addAll(selectedCartridges);
- application.addEmbbedCartridges(list);
- }
- queue.offer(true);
- } catch (OpenShiftException e) {
- queue.offer(false);
- return new Status(IStatus.ERROR, OpenShiftUIActivator.PLUGIN_ID, NLS.bind(
- "Could not embed cartridges to application {0}", getWizardModel()
- .getApplication().getName()), e);
- }
- return Status.OK_STATUS;
- }
- }, getContainer());
- return queue.poll(10, TimeUnit.SECONDS);
- } catch (Exception e) {
- return false;
- }
- }
-}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizardModel.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CreateNewApplicationWizardModel.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -1,95 +0,0 @@
-package org.jboss.tools.openshift.express.internal.ui.wizard;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.ICartridge;
-import com.openshift.express.client.IEmbeddableCartridge;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftApplicationNotAvailableException;
-import com.openshift.express.client.OpenShiftException;
-
-@Deprecated
-public class CreateNewApplicationWizardModel extends OpenShiftExpressApplicationWizardModel {
-
- /**
- * Timeout in seconds when trying to contact an application after it had been created.
- */
- private static final int APP_CREATION_TIMEOUT = 40;
- private static final String APPLICATION_NAME = "applicationName";
- private static final String APPLICATION_CARTRIDGE = "applicationCartridge";
- private static final String SELECTED_EMBEDDABLE_CARTRIDGES = "selectedEmbeddableCartridges";
-
- public CreateNewApplicationWizardModel() {
- dataModel.put(NEW_PROJECT, true);
- }
-
- private void waitForAccessible(IApplication application, IProgressMonitor monitor)
- throws OpenShiftApplicationNotAvailableException, OpenShiftException {
- // monitor.subTask("waiting for application to become accessible...");
- if (!application.waitForAccessible(APP_CREATION_TIMEOUT * 1000)) {
- throw new OpenShiftApplicationNotAvailableException(NLS.bind(
- OpenShiftExpressUIMessages.HOSTNAME_NOT_ANSWERING, application.getApplicationUrl()));
- }
- }
-
- public IApplication createApplication(String name, ICartridge cartridge, IProgressMonitor monitor) throws OpenShiftApplicationNotAvailableException, OpenShiftException {
- IUser user = OpenShiftUIActivator.getDefault().getUser();
- if (user == null) {
- throw new OpenShiftException("Could not create application, have no valid user credentials");
- }
- IApplication application = user.createApplication(name, cartridge);
- waitForAccessible(application, monitor);
- return application;
- }
-
- public void createApplication(IProgressMonitor monitor) throws OpenShiftException {
- IApplication application = createApplication(getApplicationName(), getApplicationCartridge(), monitor);
- setApplication(application);
- }
-
- @Override
- public String getApplicationName() {
- return (String) dataModel.get(APPLICATION_NAME);
- }
-
- public void setApplicationName(String applicationName) {
- dataModel.put(APPLICATION_NAME, applicationName);
- }
-
- public void setApplicationCartridge(ICartridge cartridge) {
- dataModel.put(APPLICATION_CARTRIDGE, cartridge);
- }
-
- @Override
- public ICartridge getApplicationCartridge() {
- return (ICartridge)dataModel.get(APPLICATION_CARTRIDGE);
- }
-
-// @Override
- public String getApplicationCartridgeName() {
- final ICartridge cartridge = (ICartridge)dataModel.get(APPLICATION_CARTRIDGE);
- if(cartridge != null) {
- return cartridge.getName();
- }
- return null;
- }
-
- public Set<IEmbeddableCartridge> getSelectedEmbeddableCartridges() {
- @SuppressWarnings("unchecked")
- Set<IEmbeddableCartridge> selectedEmbeddableCartridges = (Set<IEmbeddableCartridge>) dataModel.get(SELECTED_EMBEDDABLE_CARTRIDGES);
- if(selectedEmbeddableCartridges == null) {
- selectedEmbeddableCartridges = new HashSet<IEmbeddableCartridge>();
- dataModel.put(SELECTED_EMBEDDABLE_CARTRIDGES, selectedEmbeddableCartridges);
- }
- return selectedEmbeddableCartridges;
- }
-
-
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -64,7 +64,7 @@
private NewDomainWizardPageModel model;
public NewDomainWizardPage(String namespace, NewDomainWizardPageModel model, IWizard wizard) {
- super("Domain", "Create a new domain", "New Domain", wizard);
+ super("Domain Creation", "Create a new domain", "New Domain", wizard);
this.model = model;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -57,16 +57,18 @@
* @see #getUser which calls UserModel#getRecentUser if no user present at
* construction time
*/
- public OpenShiftExpressApplicationWizard() {
- this(null, null, null);
+ public OpenShiftExpressApplicationWizard(String wizardTitle) {
+ this(null, null, null, wizardTitle);
}
- public OpenShiftExpressApplicationWizard(IUser user) {
- this(user, null, null);
+ public OpenShiftExpressApplicationWizard(IUser user, String wizardTitle) {
+ this(user, null, null, wizardTitle);
}
- public OpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application) {
+ public OpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application, String wizardTitle) {
setWizardModel(new OpenShiftExpressApplicationWizardModel(user, project, application));
+ setWindowTitle(wizardTitle);
+ setNeedsProgressMonitor(true);
}
public void setSelectedApplication(IApplication application) {
@@ -79,8 +81,6 @@
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
- setWindowTitle("OpenShift Application Wizard");
- setNeedsProgressMonitor(true);
Object o = selection.getFirstElement();
if (o instanceof IUser) {
setUser((IUser) o);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ProjectAndServerAdapterSettingsWizardPage.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -59,9 +59,9 @@
private Text existingProjectNameText = null;
public ProjectAndServerAdapterSettingsWizardPage(IWizard wizard, IOpenShiftWizardModel wizardModel) {
- super("Project configuration",
+ super("Project Configuration",
"Configure your project and server adapter settings, then click 'next' or 'finish'.",
- "Project configuration", wizard);
+ "Project Configuration", wizard);
this.pageModel = new ProjectAndServerAdapterSettingsWizardPageModel(wizardModel);
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizard.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -36,14 +36,13 @@
import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPage;
import org.jboss.tools.openshift.express.internal.ui.wizard.ApplicationWizardPage;
-import org.jboss.tools.openshift.express.internal.ui.wizard.CreateNewApplicationWizard;
import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizard;
import com.openshift.express.client.OpenShiftException;
/**
* @author André Dietisheim
- * @Deprecated: see the {@link CreateNewApplicationWizard} and the {@link OpenShiftExpressApplicationWizard}
+ * @Deprecated: see {@link OpenShiftExpressApplicationWizard}
*/
@Deprecated
public class ImportProjectWizard extends Wizard implements INewWizard {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-14 13:40:36 UTC (rev 38696)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportProjectWizardModel.java 2012-02-14 14:01:11 UTC (rev 38697)
@@ -27,7 +27,6 @@
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.AdapterWizardPageModel;
-import org.jboss.tools.openshift.express.internal.ui.wizard.CreateNewApplicationWizardModel;
import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizardModel;
import com.openshift.express.client.IApplication;
@@ -37,7 +36,7 @@
/**
* @author André Dietisheim <adietish(a)redhat.com>
- * @Deprecated: see the {@link CreateNewApplicationWizardModel} and the {@link OpenShiftExpressApplicationWizardModel}
+ * @Deprecated: see {@link OpenShiftExpressApplicationWizardModel}
*/
@Deprecated
public class ImportProjectWizardModel extends ObservableUIPojo {
14 years, 1 month
JBoss Tools SVN: r38696 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2012-02-14 08:40:36 -0500 (Tue, 14 Feb 2012)
New Revision: 38696
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/editor/ScrollingTest_Jbide8701.java
Log:
https://issues.jboss.org/browse/JBIDE-8701 - fixing junit, timings were added, welcome screen is forced to close.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/editor/ScrollingTest_Jbide8701.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/editor/ScrollingTest_Jbide8701.java 2012-02-14 13:04:11 UTC (rev 38695)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/editor/ScrollingTest_Jbide8701.java 2012-02-14 13:40:36 UTC (rev 38696)
@@ -16,6 +16,8 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.intro.IIntroManager;
+import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
@@ -36,6 +38,7 @@
private final String INITIALIZATION_FAILED = "Initialization failed!"; //$NON-NLS-1$
private final String FILE_NAME = "facets.jsp"; //$NON-NLS-1$
private final long DELAY_1S = 1*1000L;
+ private final long DELAY_5S = 5*1000L;
public ScrollingTest_Jbide8701(String name) {
super(name);
@@ -79,7 +82,7 @@
assertEquals("Initital visual position is wrong", 0, scrollY); //$NON-NLS-1$
sourceEditor.setFocus();
- TestUtil.delay(DELAY_1S);
+ TestUtil.delay(DELAY_5S);
/*
* Press CTRL+END to get to the end of the page
*/
@@ -93,20 +96,24 @@
}
TestUtil.delay(DELAY_1S);
scrollY = windowInternal.getScrollY();
- assertTrue("Visual scrolling should be at the bottom of the page", scrollY > halfHeight); //$NON-NLS-1$
+ assertTrue("Visual scrolling should be at the bottom of the page,\ncurrent scrolling opstion is " //$NON-NLS-1$
+ + scrollY + ", but should be more than " + halfHeight, scrollY > halfHeight); //$NON-NLS-1$
/*
* Set visual position -- source part should be scrolled.
*/
visualEditor.setFocus();
pressKeyCode(PlatformUI.getWorkbench().getDisplay(), SWT.ARROW_UP);
+ TestUtil.delay(DELAY_1S);
domWindow.scrollTo(0,0);
- TestUtil.delay(DELAY_1S);
+ TestUtil.delay(DELAY_5S);
int topIndex = sourceEditor.getTextViewer().getTopIndex();
- assertTrue("Top source line is wrong, top line is " + topIndex + ", but should be less than 100", topIndex < 100); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Top source line is wrong, top line is " + topIndex //$NON-NLS-1$
+ + ", but should be less than 100", topIndex < 100); //$NON-NLS-1$
domWindow.scrollTo(0, halfHeight);
TestUtil.delay(DELAY_1S);
topIndex = sourceEditor.getTextViewer().getTopIndex();
- assertTrue("Top source line for the middle position is wrong, top line is " + topIndex + ", but should be less than 700", topIndex < 700); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Top source line for the middle position is wrong, top line is " //$NON-NLS-1$
+ + topIndex + ", but should be less than 700", topIndex < 700); //$NON-NLS-1$
testFinished = true;
}
}
@@ -154,10 +161,17 @@
protected void setUp() throws Exception {
super.setUp();
/*
+ * Close Welcome screen if it's opened.
+ */
+ final IIntroManager introManager =
+ PlatformUI.getWorkbench().getIntroManager();
+ IIntroPart part = introManager.getIntro();
+ introManager.closeIntro(part);
+ /*
* Set property to enable scroll correlation
*/
JspEditorPlugin.getDefault().getPreferenceStore().setValue(
- IVpePreferencesPage.SYNCHRONIZE_SCROLLING_BETWEEN_SOURCE_VISUAL_PANES, true);
+ IVpePreferencesPage.SYNCHRONIZE_SCROLLING_BETWEEN_SOURCE_VISUAL_PANES, true);
}
@Override
14 years, 1 month
JBoss Tools SVN: r38695 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6 and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-02-14 08:04:11 -0500 (Tue, 14 Feb 2012)
New Revision: 38695
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10507
Change datasource properties only if datasource is used
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 2012-02-14 13:02:26 UTC (rev 38694)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-02-14 13:04:11 UTC (rev 38695)
@@ -49,6 +49,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.connection.DriverManagerConnectionProvider;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
import org.hibernate.dialect.Dialect;
@@ -82,18 +83,15 @@
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- //https://issues.jboss.org/browse/JBIDE-10507
- //overwrite datasource properties
- if (properties == null) {
- properties = new Properties();
+ if (properties != null) {
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try and instantiate it.
+ String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
+ if (str != null && StringHelper.isEmpty(str)) {
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ // properties.setProperty( "hibernate.transaction.factory_class", "");
+ }
}
-
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try to instantiate it.
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
- properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
-
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -238,6 +236,7 @@
}
method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[]) null);
+ changeDatasourceProperties(invoke);
invoke = configureConnectionProfile(invoke);
return invoke;
} catch (HibernateConsoleRuntimeException he) {
@@ -278,6 +277,7 @@
}
}
localCfg = loadConfigurationXML(localCfg, includeMappings, entityResolver);
+ changeDatasourceProperties(localCfg);
localCfg = configureConnectionProfile(localCfg);
// replace dialect if it is set in preferences
if (StringHelper.isNotEmpty(prefs.getDialectName())) {
@@ -375,6 +375,17 @@
}
return (is != null);
}
+
+ private void changeDatasourceProperties(Configuration localCfg){
+ final Properties invokeProperties = localCfg.getProperties();
+ // set this property to null!
+ if (invokeProperties.containsKey(Environment.DATASOURCE)){
+ invokeProperties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ invokeProperties.put(Environment.CONNECTION_PROVIDER, DriverManagerConnectionProvider.class.getName());
+ invokeProperties.remove(Environment.DATASOURCE);
+ localCfg.setProperties(invokeProperties);
+ }
+ }
private Configuration configureConnectionProfile(Configuration localCfg) {
String connProfileName = prefs.getConnectionProfileName();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-14 13:02:26 UTC (rev 38694)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-14 13:04:11 UTC (rev 38695)
@@ -40,6 +40,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.connection.DriverManagerConnectionProvider;
import org.hibernate.console.ConnectionProfileUtil;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ConsoleMessages;
@@ -70,22 +71,30 @@
public ConsoleConfigurationPreferences getPreferences() {
return prefs;
}
+
+ private void changeDatasourceProperties(Configuration localCfg){
+ final Properties invokeProperties = localCfg.getProperties();
+ // set this property to null!
+ if (invokeProperties.containsKey(Environment.DATASOURCE)){
+ invokeProperties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ invokeProperties.put(Environment.CONNECTION_PROVIDER, DriverManagerConnectionProvider.class.getName());
+ invokeProperties.remove(Environment.DATASOURCE);
+ localCfg.setProperties(invokeProperties);
+ }
+ }
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- //https://issues.jboss.org/browse/JBIDE-10507
- //overwrite datasource properties
- if (properties == null) {
- properties = new Properties();
+ if (properties != null) {
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try and instantiate it.
+ String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
+ if (str != null && StringHelper.isEmpty(str)) {
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ // properties.setProperty( "hibernate.transaction.factory_class", "");
+ }
}
-
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try to instantiate it.
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
- properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
-
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -230,6 +239,7 @@
}
method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[]) null);
+ changeDatasourceProperties(invoke);
invoke = configureConnectionProfile(invoke);
return invoke;
} catch (HibernateConsoleRuntimeException he) {
@@ -270,6 +280,7 @@
}
}
localCfg = loadConfigurationXML(localCfg, includeMappings, entityResolver);
+ changeDatasourceProperties(localCfg);
localCfg = configureConnectionProfile(localCfg);
// replace dialect if it is set in preferences
if (StringHelper.isNotEmpty(prefs.getDialectName())) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-14 13:02:26 UTC (rev 38694)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-14 13:04:11 UTC (rev 38695)
@@ -86,18 +86,15 @@
public Configuration createConfiguration(Configuration localCfg, boolean includeMappings) {
Properties properties = prefs.getProperties();
- //https://issues.jboss.org/browse/JBIDE-10507
- //overwrite datasource properties
- if (properties == null) {
- properties = new Properties();
+ if (properties != null) {
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try and instantiate it.
+ String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
+ if (str != null && StringHelper.isEmpty(str)) {
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ // properties.setProperty( "hibernate.transaction.factory_class", "");
+ }
}
-
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try to instantiate it.
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
- properties.put(Environment.CONNECTION_PROVIDER, "org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
-
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -246,6 +243,7 @@
method.invoke(ejb3cfg, new Object[0]);
method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[]) null);
+ changeDatasourceProperties(invoke);
invoke = configureConnectionProfile(invoke);
return invoke;
} catch (HibernateConsoleRuntimeException he) {
@@ -286,6 +284,7 @@
}
}
localCfg = loadConfigurationXML(localCfg, includeMappings, entityResolver);
+ changeDatasourceProperties(localCfg);
localCfg = configureConnectionProfile(localCfg);
// replace dialect if it is set in preferences
if (StringHelper.isNotEmpty(prefs.getDialectName())) {
@@ -383,6 +382,17 @@
}
return (is != null);
}
+
+ private void changeDatasourceProperties(Configuration localCfg){
+ final Properties invokeProperties = localCfg.getProperties();
+ // set this property to null!
+ if (invokeProperties.containsKey(Environment.DATASOURCE)){
+ invokeProperties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ //invokeProperties.put(Environment.CONNECTION_PROVIDER, DriverManagerConnectionProvider.class.getName());
+ invokeProperties.remove(Environment.DATASOURCE);
+ localCfg.setProperties(invokeProperties);
+ }
+ }
private Configuration configureConnectionProfile(Configuration localCfg) {
String connProfileName = prefs.getConnectionProfileName();
14 years, 1 month
JBoss Tools SVN: r38694 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-14 08:02:26 -0500 (Tue, 14 Feb 2012)
New Revision: 38694
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
[JBIDE-10893] setting state to invalid credentials if the user is not valid
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14 11:34:32 UTC (rev 38693)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14 13:02:26 UTC (rev 38694)
@@ -44,6 +44,7 @@
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
/**
@@ -157,12 +158,11 @@
if (direction == Direction.BACKWARDS) {
return;
}
- if (!pageModel.areCredentialsValid()) {
- event.doit = performAuthentication();
- if (!event.doit) {
- passwordText.setFocus();
- passwordText.selectAll();
- }
+ boolean validCredemtials = performAuthentication();
+ event.doit = validCredemtials;
+ if (!event.doit) {
+ passwordText.setFocus();
+ passwordText.selectAll();
}
}
@@ -183,8 +183,7 @@
Logger.error("Failed to authenticate on OpenShift", e);
return false;
}
- boolean valid = pageModel.areCredentialsValid();
- return valid;
+ return pageModel.areCredentialsValid();
}
class CredentialsInputValidator extends MultiValidator {
@@ -205,7 +204,8 @@
// something..
final String rhLoginValue = (String) rhLoginObservable.getValue();
final String passwordValue = (String) passwordObservable.getValue();
- if (rhLoginValue != null && !rhLoginValue.isEmpty() && passwordValue != null && !passwordValue.isEmpty()) {
+ if (!StringUtils.isEmpty(rhLoginValue)
+ && !StringUtils.isEmpty(passwordValue)) {
return ValidationStatus.ok();
}
return ValidationStatus.cancel("Please provide your OpenShift Express user credentials");
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 11:34:32 UTC (rev 38693)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 13:02:26 UTC (rev 38694)
@@ -70,7 +70,7 @@
SecurePasswordStore store = null;
final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform, username);
if (key != null) {
- store = new SecurePasswordStore(key);
+ store = new SecurePasswordStore(key);
}
return store;
}
@@ -106,11 +106,11 @@
Logger.error(e.getMessage(), e);
}
}
-
+
private void erasePasswordStore() {
try {
if (store != null) {
- store.remove();
+ store.remove();
}
} catch (SecurePasswordStoreException e) {
Logger.error(e.getMessage(), e);
@@ -198,11 +198,13 @@
} else {
erasePasswordStore();
}
+ } else {
+ status = OpenShiftUIActivator.createErrorStatus(
+ NLS.bind("The credentials for user {0} are not valid", user.getRhlogin()));
+
}
} catch (NotFoundOpenShiftException e) {
// valid user without domain
- } catch (OpenShiftException e) {
- status = OpenShiftUIActivator.createErrorStatus("Your credentails are not valid.");
} catch (Exception e) {
status = OpenShiftUIActivator.createErrorStatus(NLS.bind(
"Could not check user credentials: {0}.", e.getMessage()));
14 years, 1 month
JBoss Tools SVN: r38693 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-14 06:34:32 -0500 (Tue, 14 Feb 2012)
New Revision: 38693
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
Log:
reformatted to get better readability
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14 11:29:58 UTC (rev 38692)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-02-14 11:34:32 UTC (rev 38693)
@@ -86,28 +86,29 @@
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(rhLoginText);
UIUtils.selectAllOnFocus(rhLoginText);
- final IObservableValue rhLoginObservable = BeanProperties.value(CredentialsWizardPageModel.PROPERTY_RHLOGIN)
- .observe(pageModel);
+ final IObservableValue rhLoginObservable =
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_RHLOGIN).observe(pageModel);
dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(rhLoginText), rhLoginObservable);
Label passwordLabel = new Label(container, SWT.NONE);
passwordLabel.setText("&Password");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(passwordText);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1).applyTo(passwordText);
UIUtils.selectAllOnFocus(passwordText);
- final IObservableValue passwordModelObservable = BeanProperties.value(
- CredentialsWizardPageModel.PROPERTY_PASSWORD)
- .observe(pageModel);
+ final IObservableValue passwordModelObservable =
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_PASSWORD).observe(pageModel);
final ISWTObservableValue passwordTextObservable = WidgetProperties.text(SWT.Modify).observe(passwordText);
dbc.bindValue(passwordTextObservable, passwordModelObservable);
- IObservableValue credentialsStatusObservable = BeanProperties.value(
- CredentialsWizardPageModel.PROPERTY_CREDENTIALS_STATUS).observe(pageModel);
- dbc.addValidationStatusProvider(new CredentialsInputValidator(rhLoginObservable,
- passwordModelObservable));
- final CredentialsStatusValidator credentialsStatusValidator = new CredentialsStatusValidator(
- credentialsStatusObservable, passwordTextObservable);
+ IObservableValue credentialsStatusObservable =
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_CREDENTIALS_STATUS).observe(pageModel);
+ dbc.addValidationStatusProvider(
+ new CredentialsInputValidator(rhLoginObservable, passwordModelObservable));
+ final CredentialsStatusValidator credentialsStatusValidator =
+ new CredentialsStatusValidator(credentialsStatusObservable, passwordTextObservable);
dbc.addValidationStatusProvider(credentialsStatusValidator);
ControlDecorationSupport.create(credentialsStatusValidator, SWT.LEFT | SWT.TOP);
@@ -115,12 +116,12 @@
// the text fields
Button rememberPasswordCheckBox = new Button(container, SWT.CHECK);
rememberPasswordCheckBox.setText("Save password (could trigger secure storage login)");
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(rememberPasswordCheckBox);
- final IObservableValue rememberPasswordModelObservable = BeanProperties.value(
- CredentialsWizardPageModel.PROPERTY_REMEMBER_PASSWORD)
- .observe(pageModel);
- final ISWTObservableValue rememberPasswordCheckBoxObservable = WidgetProperties.selection().observe(
- rememberPasswordCheckBox);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(rememberPasswordCheckBox);
+ final IObservableValue rememberPasswordModelObservable =
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_REMEMBER_PASSWORD).observe(pageModel);
+ final ISWTObservableValue rememberPasswordCheckBoxObservable =
+ WidgetProperties.selection().observe(rememberPasswordCheckBox);
dbc.bindValue(rememberPasswordCheckBoxObservable, rememberPasswordModelObservable);
}
14 years, 1 month
JBoss Tools SVN: r38692 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: messages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-02-14 06:29:58 -0500 (Tue, 14 Feb 2012)
New Revision: 38692
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
Log:
Fixed - JBIDE-10858 Edit new domain has wrong title
https://issues.jboss.org/browse/JBIDE-10858
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-02-14 11:23:43 UTC (rev 38691)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-02-14 11:29:58 UTC (rev 38692)
@@ -16,7 +16,7 @@
public class CreateOrEditDomainAction extends AbstractAction {
public CreateOrEditDomainAction() {
- super(OpenShiftExpressUIMessages.EDIT_DOMAIN_ACTION);
+ super(OpenShiftExpressUIMessages.CREATE_OR_EDIT_DOMAIN_ACTION);
setImageDescriptor(OpenShiftUIActivator.getDefault().createImageDescriptor("edit.gif"));
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java 2012-02-14 11:23:43 UTC (rev 38691)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.java 2012-02-14 11:29:58 UTC (rev 38692)
@@ -18,7 +18,7 @@
public static String TAIL_SERVER_LOG_ACTION;
- public static String EDIT_DOMAIN_ACTION;
+ public static String CREATE_OR_EDIT_DOMAIN_ACTION;
public static String SHOW_IN_ACTION_GROUP;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-02-14 11:23:43 UTC (rev 38691)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/messages/OpenShiftExpressUIMessages.properties 2012-02-14 11:29:58 UTC (rev 38692)
@@ -2,7 +2,7 @@
TAIL_SERVER_LOG_ACTION=Remote console
#
-EDIT_DOMAIN_ACTION=Edit Domain
+CREATE_OR_EDIT_DOMAIN_ACTION=Create or Edit Domain
#
SHOW_IN_ACTION_GROUP=Show In
SHOW_IN_BROWSER_ACTION=Web Browser
14 years, 1 month
JBoss Tools SVN: r38691 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-14 06:23:43 -0500 (Tue, 14 Feb 2012)
New Revision: 38691
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
logging exception
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 11:21:43 UTC (rev 38690)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 11:23:43 UTC (rev 38691)
@@ -122,7 +122,7 @@
try {
configuredUsername = new OpenShiftConfiguration().getRhlogin();
} catch (Exception e) {
- // do nothing
+ Logger.error("Cound not retrieve rhlogin from express configuration");
}
return configuredUsername;
}
14 years, 1 month
JBoss Tools SVN: r38690 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-02-14 06:21:43 -0500 (Tue, 14 Feb 2012)
New Revision: 38690
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
[JBIDE-10893] cleanup
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 11:18:00 UTC (rev 38689)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-14 11:21:43 UTC (rev 38690)
@@ -46,15 +46,14 @@
private IStatus credentialsStatus;
private StringPreferenceValue rhLoginPreferenceValue;
private final String libraServer;
-
private SecurePasswordStore store;
public CredentialsWizardPageModel() {
this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID);
this.libraServer = initLibraServer();
this.rhLogin = initRhLogin();
- initSecureStore(libraServer, rhLogin);
- initPassword();
+ this.store = initSecureStore(libraServer, rhLogin);
+ this.password = initPassword();
resetCredentialsStatus();
}
@@ -67,11 +66,13 @@
return null;
}
- private void initSecureStore(final String platform, final String username) {
+ private SecurePasswordStore initSecureStore(final String platform, final String username) {
+ SecurePasswordStore store = null;
final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform, username);
if (key != null) {
- this.store = new SecurePasswordStore(key);
+ store = new SecurePasswordStore(key);
}
+ return store;
}
protected String initRhLogin() {
@@ -83,15 +84,17 @@
return rhLogin;
}
- protected void initPassword() {
+ protected String initPassword() {
+ String password = null;
if (libraServer != null && rhLogin != null && !rhLogin.isEmpty() && store != null) {
try {
- this.password = store.getPassword();
+ password = store.getPassword();
setRememberPassword(this.password != null && !this.password.isEmpty());
} catch (SecurePasswordStoreException e) {
Logger.error("Failed to retrieve OpenShift user's password from Secured Store", e);
}
}
+ return password;
}
private void storePassword(String password) {
14 years, 1 month