[jboss-cvs] jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards ...
Robert Stryker
rawblem at gmail.com
Thu Nov 9 19:30:23 EST 2006
User: rawb
Date: 06/11/09 19:30:23
Modified: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards
AbstractJBossServerWizardFragment.java
AbstractJBossRuntimeWizardFragment.java
Added: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards
JBossConfigurationTableViewer.java
Removed: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards
NewMBeanWizard.java ServerCloneWizard.java
Log:
Rewrote ui entirely
Revision Changes Path
1.4 +7 -26 jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/AbstractJBossServerWizardFragment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractJBossServerWizardFragment.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/AbstractJBossServerWizardFragment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- AbstractJBossServerWizardFragment.java 21 Sep 2006 19:52:43 -0000 1.3
+++ AbstractJBossServerWizardFragment.java 10 Nov 2006 00:30:23 -0000 1.4
@@ -26,27 +26,18 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.IVMInstallType;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
@@ -54,7 +45,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -63,12 +53,9 @@
import org.eclipse.wst.server.core.internal.ServerType;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
+import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.server.runtime.JBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.util.ASDebug;
import org.jboss.ide.eclipse.as.ui.Messages;
-import org.jboss.ide.eclipse.as.ui.util.JBossConfigurationTableViewer;
public class AbstractJBossServerWizardFragment extends WizardFragment {
//private final static int UNKNOWN_CHANGED = 0;
@@ -97,7 +84,7 @@
private IVMInstall selectedVM;
private JBossServer server;
- private JBossServerRuntime runtime;
+ private IJBossServerRuntime runtime;
@@ -392,19 +379,19 @@
if( wc instanceof RuntimeWorkingCopy ) {
RuntimeWorkingCopy rwc = (RuntimeWorkingCopy)wc;
homeDirText.setText(rwc.getLocation().toOSString());
- configText.setText(rwc.getAttribute(JBossServerRuntime.PROPERTY_CONFIGURATION_NAME, ""));
+ configText.setText(rwc.getAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, ""));
String[] vmNames = jreCombo.getItems();
- IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(rwc.getAttribute(JBossServerRuntime.PROPERTY_VM_TYPE_ID, ""));
- String vmId = rwc.getAttribute(JBossServerRuntime.PROPERTY_VM_ID, "");
+ IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(rwc.getAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, ""));
+ String vmId = rwc.getAttribute(IJBossServerRuntime.PROPERTY_VM_ID, "");
IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
int comboIndex = -1;
for (int i = 0; i < vmNames.length && comboIndex == -1; i++) {
for( int j = 0; j < vmInstalls.length && comboIndex == -1; j++ ) {
- ASDebug.p("comparing " + vmNames[i] + " with " + vmInstalls[j].getName(), this);
+// ASDebug.p("comparing " + vmNames[i] + " with " + vmInstalls[j].getName(), this);
if (vmNames[i].equals(vmInstalls[j].getName()) && vmInstalls[j].getId().equals(vmId))
comboIndex = i;
}
@@ -422,7 +409,7 @@
public void performFinish(IProgressMonitor monitor) throws CoreException {
IServerWorkingCopy serverWC = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
IRuntime r = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
- runtime = (JBossServerRuntime) r.loadAdapter(JBossServerRuntime.class, null);
+ runtime = (IJBossServerRuntime) r.loadAdapter(IJBossServerRuntime.class, null);
@@ -438,12 +425,6 @@
if( server == null ) {
server = (JBossServer) serverWC.loadAdapter(JBossServer.class, new NullProgressMonitor());
}
-
- try {
- server.setRuntime(runtime);
- } catch( Exception e ) {
- }
-
}
public boolean isComplete() {
1.4 +11 -17 jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/AbstractJBossRuntimeWizardFragment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractJBossRuntimeWizardFragment.java
===================================================================
RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/AbstractJBossRuntimeWizardFragment.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- AbstractJBossRuntimeWizardFragment.java 14 Sep 2006 21:00:48 -0000 1.3
+++ AbstractJBossRuntimeWizardFragment.java 10 Nov 2006 00:30:23 -0000 1.4
@@ -51,9 +51,7 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
@@ -64,9 +62,8 @@
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.jboss.ide.eclipse.as.core.server.runtime.JBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.ui.Messages;
-import org.jboss.ide.eclipse.as.ui.util.JBossConfigurationTableViewer;
/**
* @author Stryker
@@ -135,7 +132,7 @@
nameText.setText(rwc.getName());
homeDirText.setText(rwc.getLocation().toOSString());
- String configSelected = rwc.getAttribute(JBossServerRuntime.PROPERTY_CONFIGURATION_NAME, "");
+ String configSelected = rwc.getAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, "");
configurations.setDefaultConfiguration(configSelected);
configurations.getTable().setVisible(false);
@@ -144,9 +141,9 @@
homeDirButton.setEnabled(false);
try {
- Object o = rwc.loadAdapter(JBossServerRuntime.class, new NullProgressMonitor());
+ Object o = rwc.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
if( o != null ) {
- JBossServerRuntime jbsr = (JBossServerRuntime)o;
+ IJBossServerRuntime jbsr = (IJBossServerRuntime)o;
IVMInstall install = jbsr.getVM();
String vmName = install.getName();
String[] jres = jreCombo.getItems();
@@ -178,7 +175,7 @@
private boolean isPristineRuntime() {
RuntimeWorkingCopy rwc = getRuntimeWorkingCopy();
if( rwc != null ) {
- if( rwc.getAttribute(JBossServerRuntime.PROPERTY_CONFIGURATION_NAME, (String)null) == null ) {
+ if( rwc.getAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, (String)null) == null ) {
return true;
}
return false;
@@ -511,14 +508,11 @@
runtimeWC.setName(name);
runtimeWC.setLocation(new Path(homeDir));
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM.getVMInstallType().getId());
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations.getSelectedConfiguration());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM.getVMInstallType().getId());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations.getSelectedConfiguration());
getTaskModel().putObject(TaskModel.TASK_RUNTIME, runtimeWC);
-// JBossServerRuntime runtime = (JBossServerRuntime)runtimeWC.loadAdapter(JBossServerRuntime.class, new NullProgressMonitor());
-// runtime.setVMInstall(selectedVM);
-
}
private void createConfigurationComposite(Composite main) {
@@ -570,9 +564,9 @@
IRuntimeWorkingCopy runtimeWC = r.createWorkingCopy();
runtimeWC.setName(name);
runtimeWC.setLocation(new Path(homeDir));
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM.getVMInstallType().getId());
- ((RuntimeWorkingCopy)runtimeWC).setAttribute(JBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations.getSelectedConfiguration());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, selectedVM.getId());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, selectedVM.getVMInstallType().getId());
+ ((RuntimeWorkingCopy)runtimeWC).setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configurations.getSelectedConfiguration());
IRuntime saved = runtimeWC.save(false, new NullProgressMonitor());
getTaskModel().putObject(TaskModel.TASK_RUNTIME, saved);
1.1 date: 2006/11/10 00:30:23; author: rawb; state: Exp;jbosside/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossConfigurationTableViewer.java
Index: JBossConfigurationTableViewer.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.ide.eclipse.as.ui.wizards;
import java.io.File;
import java.util.ArrayList;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
/**
* @author Marshall
*/
public class JBossConfigurationTableViewer extends TableViewer
{
//private String jbossHome;
private String selectedConfiguration;
private WizardFragment fragment;
public JBossConfigurationTableViewer (Composite parent)
{
super (parent);
init();
}
public JBossConfigurationTableViewer (Composite parent, int style)
{
super (parent, style);
init();
}
public JBossConfigurationTableViewer (Table table)
{
super (table);
init();
}
public void setJBossHome (String jbossHome)
{
//this.jbossHome = jbossHome;
setInput(jbossHome);
}
public String getSelectedConfiguration ()
{
return selectedConfiguration;
}
public void setDefaultConfiguration (String defaultConfiguration)
{
int item = -1;
TableItem items[] = getTable().getItems();
for (int i = 0; i < items.length; i++)
{
if (items[i] != null && items[i].getText() != null && items[i].getText().equals(defaultConfiguration))
{
item = i;
break;
}
}
if (item != -1) {
getTable().setSelection(item);
}
selectedConfiguration = defaultConfiguration;
}
private void init ()
{
ConfigurationProvider provider = new ConfigurationProvider();
setContentProvider(provider);
setLabelProvider(provider);
getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
getControl().setEnabled(false);
addSelectionChangedListener(new ISelectionChangedListener()
{
public void selectionChanged(SelectionChangedEvent event)
{
configurationSelected();
}
});
}
protected String getCurrentlySelectedConfiguration ()
{
if (getSelection() instanceof IStructuredSelection)
{
IStructuredSelection selection = (IStructuredSelection) getSelection();
return (String) selection.getFirstElement();
}
return null;
}
protected void configurationSelected ()
{
selectedConfiguration = getCurrentlySelectedConfiguration();
if (fragment != null)
{
fragment.updateChildFragments();
}
}
protected class ConfigurationProvider implements IStructuredContentProvider, ILabelProvider
{
public void dispose() {
// ignore
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// ignore
}
public Object[] getElements(Object inputElement)
{
ArrayList configList = new ArrayList();
File serverDirectory = new File(inputElement.toString() + File.separator + "server");
if (serverDirectory.exists())
{
File types[] = serverDirectory.listFiles();
for (int i = 0; i < types.length; i++)
{
File serviceDescriptor = new File(
types[i].getAbsolutePath() + File.separator +
"conf" + File.separator + "jboss-service.xml");
if (types[i].isDirectory() && serviceDescriptor.exists())
{
String configuration = types[i].getName();
// Can't shutdown the minimal configuration -- hopefully we can find something a little less crude in the future.
//if (!configuration.equals("minimal"))
configList.add(configuration);
}
}
if (configList.size() > 0)
{
getControl().setEnabled(true);
}
}
return configList.toArray();
}
public void addListener(ILabelProviderListener listener) {
// ignore
}
public boolean isLabelProperty(Object element, String property) { return false; }
public void removeListener(ILabelProviderListener listener) {
// ignore
}
public Image getImage(Object element)
{
return JBossServerUISharedImages.getImage(JBossServerUISharedImages.IMG_JBOSS_CONFIGURATION);
}
public String getText(Object element)
{
return (String) element;
}
}
public void setWizardFragment(WizardFragment fragment) {
this.fragment = fragment;
}
}
More information about the jboss-cvs-commits
mailing list