Author: rob.stryker(a)jboss.com
Date: 2007-08-15 13:01:59 -0400 (Wed, 15 Aug 2007)
New Revision: 3150
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerPollerTimeoutListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
cleaning up of server and runtime wizards, movement of xpath initialization to server
creation
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -25,12 +25,9 @@
import java.util.HashMap;
import java.util.Iterator;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as.core.runtime.server.IServerPollerTimeoutListener;
-import org.jboss.ide.eclipse.as.core.runtime.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.runtime.server.ServerStatePollerType;
/**
@@ -45,36 +42,6 @@
return instance;
}
- private HashMap pollerListeners = null;
- public IServerPollerTimeoutListener[] getTimeoutListeners(String pollerClass) {
- if( pollerListeners == null )
- loadTimeoutListeners();
- ArrayList list = (ArrayList)pollerListeners.get(pollerClass);
- if( list != null ) {
- return (IServerPollerTimeoutListener[]) list.toArray(new
IServerPollerTimeoutListener[list.size()]);
- }
- return new IServerPollerTimeoutListener[0];
- }
-
- protected void loadTimeoutListeners() {
- pollerListeners = new HashMap();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf =
registry.getConfigurationElementsFor(JBossServerCorePlugin.PLUGIN_ID,
"pollerTimeoutListener");
- for( int i = 0; i < cf.length; i++ ) {
- try {
- String poller = cf[i].getAttribute("pollerType");
- Object listener = cf[i].createExecutableExtension("listener");
-
- ArrayList list = (ArrayList)pollerListeners.get(poller);
- if( list == null ) list = new ArrayList();
- list.add(listener);
- pollerListeners.put(poller, list);
- } catch( CoreException ce ) {
- ce.printStackTrace();
- }
- }
- }
-
private HashMap pollers;
public void loadPollers() {
pollers = new HashMap();
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathCategory.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -2,15 +2,15 @@
import java.util.HashMap;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
+import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
public class XPathCategory {
protected String name; // cannot include delimiter from the model, comma
- protected JBossServer server;
+ protected IServer server;
protected HashMap children;
- public XPathCategory(String name, JBossServer server) {
+ public XPathCategory(String name, IServer server) {
this.name = name;
this.server = server;
}
@@ -48,7 +48,7 @@
}
public void save() {
- ServerAttributeHelper helper = server.getAttributeHelper();
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
XPathModel.getDefault().saveCategory(this, server, helper);
helper.save();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/model/descriptor/XPathModel.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -12,9 +12,9 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
public class XPathModel {
@@ -34,44 +34,38 @@
return instance;
}
- protected HashMap serverToCategories;
+ protected HashMap<String, ArrayList<XPathCategory>> serverToCategories;
public XPathModel() {
- serverToCategories = new HashMap();
+ serverToCategories = new HashMap<String, ArrayList<XPathCategory>>();
}
- public XPathQuery getQuery(JBossServer jbs, IPath path) {
- XPathCategory cat = getCategory(jbs, path.segment(0));
+ public XPathQuery getQuery(IServer server, IPath path) {
+ XPathCategory cat = getCategory(server, path.segment(0));
if( cat != null )
return cat.getQuery(path.segment(1));
return null;
}
- public ArrayList getCategoryCollection(JBossServer jbs) {
- if( serverToCategories.get(jbs.getServer().getId()) == null ) {
- ArrayList val = new ArrayList(Arrays.asList(load(jbs)));
- if( val.size() == 0 ) {
- val = loadDefaults(jbs);
- serverToCategories.put(jbs.getServer().getId(), val);
- save(jbs);
- } else {
- serverToCategories.put(jbs.getServer().getId(), val);
- }
+ public ArrayList<XPathCategory> getCategoryCollection(IServer server) {
+ if( serverToCategories.get(server.getId()) == null ) {
+ ArrayList<XPathCategory> val = new
ArrayList<XPathCategory>(Arrays.asList(load(server)));
+ serverToCategories.put(server.getId(), val);
}
- return (ArrayList)serverToCategories.get(jbs.getServer().getId());
+ return (ArrayList<XPathCategory>)serverToCategories.get(server.getId());
}
- public XPathCategory[] getCategories(JBossServer jbs) {
- ArrayList val = getCategoryCollection(jbs);
+ public XPathCategory[] getCategories(IServer jbs) {
+ ArrayList<XPathCategory> val = getCategoryCollection(jbs);
return (XPathCategory[]) val.toArray(new XPathCategory[val.size()]);
}
- public boolean containsCategory(JBossServer jbs, String name) {
+ public boolean containsCategory(IServer jbs, String name) {
return getCategory(jbs, name) == null ? false : true;
}
- public XPathCategory getCategory(JBossServer jbs, String name) {
- ArrayList list = getCategoryCollection(jbs);
- Iterator i = list.iterator();
+ public XPathCategory getCategory(IServer jbs, String name) {
+ ArrayList<XPathCategory> list = getCategoryCollection(jbs);
+ Iterator<XPathCategory> i = list.iterator();
XPathCategory c;
while(i.hasNext()) {
c = (XPathCategory)i.next();
@@ -81,7 +75,7 @@
return null;
}
- public XPathCategory addCategory(JBossServer jbs, String name) {
+ public XPathCategory addCategory(IServer jbs, String name) {
if( !containsCategory(jbs, name)) {
XPathCategory c = new XPathCategory(name, jbs);
getCategoryCollection(jbs).add(c);
@@ -90,15 +84,15 @@
return getCategory(jbs, name);
}
- public void addCategory(JBossServer jbs, XPathCategory category) {
- if( !containsCategory(jbs, category.getName())) {
- getCategoryCollection(jbs).add(category);
+ public void addCategory(IServer server, XPathCategory category) {
+ if( !containsCategory(server, category.getName())) {
+ getCategoryCollection(server).add(category);
}
}
- public void removeCategory(JBossServer jbs, String name) {
- ArrayList list = getCategoryCollection(jbs);
- Iterator i = list.iterator();
+ public void removeCategory(IServer server, String name) {
+ ArrayList<XPathCategory> list = getCategoryCollection(server);
+ Iterator<XPathCategory> i = list.iterator();
while(i.hasNext()) {
XPathCategory cat = (XPathCategory)i.next();
if( cat.getName().equals(name)) {
@@ -111,38 +105,37 @@
/*
* Loading and saving is below
*/
- private XPathCategory[] load(JBossServer jbs) {
- ServerAttributeHelper helper = jbs.getAttributeHelper();
+ private XPathCategory[] load(IServer server) {
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
String list = helper.getAttribute(CATEGORY_LIST, (String)null);
- System.out.println("load " + CATEGORY_LIST + ", got " + list);
if( list == null )
return new XPathCategory[] {};
String[] byName = list.split(DELIMITER);
XPathCategory[] cats = new XPathCategory[byName.length];
for( int i = 0; i < byName.length; i++ ) {
- cats[i] = new XPathCategory(byName[i], jbs);
+ cats[i] = new XPathCategory(byName[i], server);
}
return cats;
}
- public void save(JBossServer jbs) {
- if( !serverToCategories.containsKey(jbs.getServer().getId()))
+ public void save(IServer server) {
+ if( !serverToCategories.containsKey(server.getId()))
return;
- ServerAttributeHelper helper = jbs.getAttributeHelper();
- XPathCategory[] categories = getCategories(jbs);
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
+ XPathCategory[] categories = getCategories(server);
String list = "";
for( int i = 0; i < categories.length; i++ ) {
if( i != 0 )
list += DELIMITER;
list += categories[i].getName();
- saveCategory(categories[i], jbs, helper);
+ saveCategory(categories[i], server, helper);
}
helper.setAttribute(CATEGORY_LIST, list);
helper.save();
}
- public void saveCategory(XPathCategory category, JBossServer jbs, ServerAttributeHelper
helper) {
+ public void saveCategory(XPathCategory category, IServer server, ServerAttributeHelper
helper) {
if( category.queriesLoaded()) {
XPathQuery[] queries = category.getQueries();
String val = "";
@@ -150,35 +143,31 @@
if( i != 0 )
val += DELIMITER;
val += category.getName() + Path.SEPARATOR + queries[i].getName();
- saveQuery(queries[i], category, jbs, helper);
+ saveQuery(queries[i], category, server, helper);
}
helper.setAttribute(QUERY_LIST + "." + category.getName().replace('
', '_'), val);
- System.out.println("save " + QUERY_LIST + "." + category.getName()
+ " with " + val);
}
}
- private void saveQuery(XPathQuery query, XPathCategory category, JBossServer jbs,
ServerAttributeHelper helper) {
- ArrayList list = new ArrayList();
+ private void saveQuery(XPathQuery query, XPathCategory category, IServer server,
ServerAttributeHelper helper) {
+ ArrayList<String> list = new ArrayList<String>();
list.add(query.getBaseDir());
list.add(query.getFilePattern() == null ? EMPTY_STRING : query.getFilePattern());
list.add(query.getXpathPattern() == null ? EMPTY_STRING : query.getXpathPattern());
list.add(query.getAttribute() == null ? EMPTY_STRING : query.getAttribute());
helper.setAttribute(QUERY + "." + category.getName().replace(' ',
'_') + Path.SEPARATOR + query.getName().replace(' ', '_'), list);
- System.out.println("saved " + QUERY + "." + category.getName() +
Path.SEPARATOR + query.getName() + " with " + list);
}
- public XPathQuery[] loadQueries(XPathCategory category, JBossServer jbs) {
- ServerAttributeHelper helper = jbs.getAttributeHelper();
+ public XPathQuery[] loadQueries(XPathCategory category, IServer server) {
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
String list = helper.getAttribute(QUERY_LIST + "." +
category.getName().replace(' ', '_'), (String)null);
- System.out.println("load " + QUERY_LIST + "." + category.getName()
+ " gets " + list);
if( list == null )
return new XPathQuery[] {};
String[] queriesByName = list.split(DELIMITER);
- List queryAsStringValues;
- ArrayList returnList = new ArrayList();
+ List<String> queryAsStringValues;
+ ArrayList<XPathQuery> returnList = new ArrayList();
for( int i = 0; i < queriesByName.length; i++ ) {
queryAsStringValues = helper.getAttribute(QUERY + "." +
queriesByName[i].replace(' ', '_'), (List)null);
- System.out.println("load " + QUERY + "." + queriesByName[i]);
if( queryAsStringValues != null ) {
try {
XPathQuery q =new
XPathQuery(queriesByName[i].substring(queriesByName[i].indexOf(Path.SEPARATOR)+1),
queryAsStringValues);
@@ -196,29 +185,28 @@
* Loading the defaults for the server
* returns the category created
*/
- private static HashMap rtToPortsFile;
+ private static HashMap<String, IPath> rtToPortsFile;
private static final String ATTRIBUTE_SUFFIX = "_ATTRIBUTE";
private static final String FILE_SUFFIX = "_FILE";
static {
- rtToPortsFile = new HashMap();
+ rtToPortsFile = new HashMap<String, IPath>();
rtToPortsFile.put("3.2", new
Path("properties").append("jboss.32.default.ports.properties"));
rtToPortsFile.put("4.0", new
Path("properties").append("jboss.40.default.ports.properties"));
rtToPortsFile.put("4.2", new
Path("properties").append("jboss.42.default.ports.properties"));
rtToPortsFile.put("5.0", new
Path("properties").append("jboss.50.default.ports.properties"));
}
- protected ArrayList loadDefaults(JBossServer jbs) {
- ArrayList retVal = new ArrayList();
- String configFolder;
- configFolder = jbs.getConfigDirectory(false); // do not check the launch config
+ public void loadDefaults(IServer server, String configFolder) {
+ ArrayList<XPathCategory> retVal = new ArrayList<XPathCategory>();
AbstractJBossServerRuntime ajbsr = (AbstractJBossServerRuntime)
- jbs.getServer().getRuntime().loadAdapter(AbstractJBossServerRuntime.class, new
NullProgressMonitor());
+ server.getRuntime().loadAdapter(AbstractJBossServerRuntime.class, new
NullProgressMonitor());
Path p = (Path)rtToPortsFile.get(ajbsr.getId());
+ if( p == null ) return;
URL url = FileLocator.find(JBossServerCorePlugin.getDefault().getBundle(), p, null);
Properties pr = new Properties();
try {
pr.load(url.openStream());
- XPathCategory ports = new XPathCategory("Ports", jbs);
+ XPathCategory ports = new XPathCategory("Ports", server);
Iterator i = pr.keySet().iterator();
String name, xpath, attributeName, file;
XPathQuery query;
@@ -236,6 +224,8 @@
} catch( Exception e ) {
e.printStackTrace();
}
- return retVal;
+
+ serverToCategories.put(server.getId(), retVal);
+ //save(server);
}
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerPollerTimeoutListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerPollerTimeoutListener.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/IServerPollerTimeoutListener.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -1,28 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, 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.core.runtime.server;
-
-import org.eclipse.wst.server.core.IServer;
-
-public interface IServerPollerTimeoutListener {
- public void serverTimedOut(IServer server, boolean expectedState);
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -59,12 +59,9 @@
public JBossServer() {
}
-
protected void initialize() {
-
}
-
public void setDefaults(IProgressMonitor monitor) {
}
@@ -77,13 +74,11 @@
public void configurationChanged() {
}
-
public IJBossServerLaunchDefaults getLaunchDefaults() {
return new ServerLaunchDefaults(getServer());
}
-
/*
* Abstracts to implement
*/
@@ -198,7 +193,7 @@
protected int findPort(IPath path) {
try {
- XPathQuery query = XPathModel.getDefault().getQuery(this, path);
+ XPathQuery query = XPathModel.getDefault().getQuery(getServer(), path);
String result = query.getFirstResult();
if( result != null ) {
return Integer.parseInt(result);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/ServerAttributeHelper.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
/**
@@ -39,6 +40,16 @@
*/
public class ServerAttributeHelper {
+ public static ServerAttributeHelper createHelper(IServer iserver) {
+ if( iserver instanceof Server ) {
+ IServerWorkingCopy copy = ((Server)iserver).createWorkingCopy();
+ if( copy != null ) {
+ return new ServerAttributeHelper(iserver, copy);
+ }
+ }
+ return null;
+ }
+
private ServerWorkingCopy wch;
private IServer server;
public ServerAttributeHelper(IServer server, IServerWorkingCopy copy) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -7,13 +7,10 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.IModuleVisitor;
import org.eclipse.wst.server.core.internal.ProgressUtil;
import org.eclipse.wst.server.core.internal.Server;
@@ -135,7 +132,6 @@
// Basically stolen from RunOnServerActionDelegate
public IStatus publishOneModule(int kind, IModule[] module, int deltaKind,
IProgressMonitor monitor) {
- addAndRemoveModules( module, deltaKind);
ArrayList moduleList = new ArrayList();
ArrayList deltaKindList = new ArrayList();
moduleList.add(module);
@@ -177,19 +173,19 @@
return Status.CANCEL_STATUS;
}
- protected void addAndRemoveModules(IModule[] module, int deltaKind) {
- if( getServer() == null ) return;
- boolean contains = ServerUtil.containsModule(getServer(), module[0], new
NullProgressMonitor());
- try {
- if( !contains && (deltaKind == ServerBehaviourDelegate.ADDED) || (deltaKind ==
ServerBehaviourDelegate.CHANGED)) {
- IServerWorkingCopy wc = getServer().createWorkingCopy();
- ServerUtil.modifyModules(wc, module, new IModule[0], new NullProgressMonitor());
- wc.save(false, new NullProgressMonitor());
- } else if( contains && deltaKind == ServerBehaviourDelegate.REMOVED) {
- IServerWorkingCopy wc = getServer().createWorkingCopy();
- ServerUtil.modifyModules(wc, new IModule[0], module, new NullProgressMonitor());
- wc.save(false, new NullProgressMonitor());
- }
- } catch( Exception e ) {} // swallowed
- }
+// protected void addAndRemoveModules(IModule[] module, int deltaKind) {
+// if( getServer() == null ) return;
+// boolean contains = ServerUtil.containsModule(getServer(), module[0], new
NullProgressMonitor());
+// try {
+// if( !contains && (deltaKind == ServerBehaviourDelegate.ADDED) || (deltaKind
== ServerBehaviourDelegate.CHANGED)) {
+// IServerWorkingCopy wc = getServer().createWorkingCopy();
+// ServerUtil.modifyModules(wc, module, new IModule[0], new
NullProgressMonitor());
+// wc.save(false, new NullProgressMonitor());
+// } else if( contains && deltaKind == ServerBehaviourDelegate.REMOVED) {
+// IServerWorkingCopy wc = getServer().createWorkingCopy();
+// ServerUtil.modifyModules(wc, new IModule[0], module, new NullProgressMonitor());
+// wc.save(false, new NullProgressMonitor());
+// }
+// } catch( Exception e ) {} // swallowed
+// }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-15 17:01:23 UTC (rev
3149)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-08-15 17:01:59 UTC (rev
3150)
@@ -11,7 +11,7 @@
behaviourClass="org.jboss.ide.eclipse.as.core.server.JBossServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.JBossServer"
description="%jboss.version.32.description"
- hasConfiguration="true"
+ hasConfiguration="false"
id="org.jboss.ide.eclipse.as.32"
initialState="stopped"
launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
@@ -28,7 +28,7 @@
behaviourClass="org.jboss.ide.eclipse.as.core.server.JBossServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.JBossServer"
description="%jboss.version.40.description"
- hasConfiguration="true"
+ hasConfiguration="false"
id="org.jboss.ide.eclipse.as.40"
initialState="stopped"
launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
@@ -45,7 +45,7 @@
behaviourClass="org.jboss.ide.eclipse.as.core.server.JBossServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.JBossServer"
description="%jboss.version.42.description"
- hasConfiguration="true"
+ hasConfiguration="false"
id="org.jboss.ide.eclipse.as.42"
initialState="stopped"
launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2007-08-15 17:01:23
UTC (rev 3149)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2007-08-15 17:01:59
UTC (rev 3150)
@@ -51,7 +51,7 @@
org.eclipse.wst.ws.ui,
org.apache.ant,
org.jboss.ide.eclipse.as.core,
- org.jboss.ide.eclipse.firstrun,
+ org.jboss.ide.eclipse.firstrun;resolution:=optional,
org.jboss.ide.eclipse.archives.core,
org.jboss.ide.eclipse.archives.ui
Eclipse-LazyStart: true
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -42,7 +42,9 @@
public static final String WIZBAN_JBOSS32_LOGO = "jboss32logo";
public static final String WIZBAN_JBOSS40_LOGO = "jboss40logo";
public static final String WIZBAN_JBOSS42_LOGO = "jboss42logo";
+ public static final String WIZBAN_DEPLOY_ONLY_LOGO = "jbossdeployerlogo";
+
public static final String TWIDDLE_IMAGE = "TWIDDLE_IMAGE";
public static final String INACTIVE_CATEGORY_IMAGE =
"INACTIVE_CATEGORY_IMAGE";
public static final String GENERIC_SERVER_IMAGE = "GENERIC_SERVER_IMAGE";
@@ -54,8 +56,7 @@
private Hashtable images, descriptors;
- private JBossServerUISharedImages ()
- {
+ private JBossServerUISharedImages () {
instance = this;
images = new Hashtable();
descriptors = new Hashtable();
@@ -67,7 +68,7 @@
descriptors.put(WIZBAN_JBOSS32_LOGO, createImageDescriptor(pluginBundle,
"/icons/logo32.gif"));
descriptors.put(WIZBAN_JBOSS40_LOGO, createImageDescriptor(pluginBundle,
"/icons/logo40.gif"));
descriptors.put(WIZBAN_JBOSS42_LOGO, createImageDescriptor(pluginBundle,
"/icons/logo42.gif"));
-
+ descriptors.put(WIZBAN_DEPLOY_ONLY_LOGO, createImageDescriptor(pluginBundle,
"/icons/blank.gif"));
descriptors.put(TWIDDLE_IMAGE, createImageDescriptor(pluginBundle,
"icons/twiddle.gif"));
descriptors.put(INACTIVE_CATEGORY_IMAGE, createImageDescriptor(pluginBundle,
"/icons/inactiveCat.gif"));
descriptors.put(PUBLISH_IMAGE, createImageDescriptor(pluginBundle,
"/icons/publish.gif"));
@@ -81,7 +82,6 @@
images.put(key, descriptor.createImage());
}
-
images.put(GENERIC_SERVER_IMAGE,
ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_NEW_SERVER).createImage());
descriptors.put(GENERIC_SERVER_IMAGE,
ImageDescriptor.createFromImage((Image)images.get(GENERIC_SERVER_IMAGE)));
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/ConvertNodeToXPathDialog.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -46,12 +46,12 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathCategory;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathModel;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathQuery;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathDialog;
import org.w3c.dom.NamedNodeMap;
@@ -280,16 +280,16 @@
ConvertNodeToXPathDialog d = new ConvertNodeToXPathDialog(new Shell(), node,
attributeName);
int result = -1;
try {
- result = d.open();
+ result = d.open();
} catch(Exception e) {e.printStackTrace(); }
if( result == Window.OK) {
- JBossServer s = d.getServer();
+ IServer s = d.getServer();
String category = d.getCategory();
XPathCategory cat = XPathModel.getDefault().getCategory(s, category);
if( cat == null ) {
cat = XPathModel.getDefault().addCategory(s, category);
}
- XPathQuery q = new XPathQuery(d.getName(), s.getConfigDirectory(), null,
d.getXpath(), d.getAttribute());
+ XPathQuery q = new XPathQuery(d.getName(), XPathDialogs.getConfigFolder(s), null,
d.getXpath(), d.getAttribute());
cat.addQuery(q);
cat.save();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/XPathDialogs.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -28,6 +28,7 @@
import java.util.TreeSet;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -62,6 +63,7 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.core.model.descriptor.XMLDocumentRepository;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathCategory;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult;
@@ -69,7 +71,6 @@
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathQuery;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult.XPathResultNode;
import org.jboss.ide.eclipse.as.core.server.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.Messages;
import
org.jboss.ide.eclipse.as.ui.views.server.providers.descriptors.XPathPropertyLabelProvider;
@@ -83,15 +84,15 @@
private String initialName;
private String currentText;
- private JBossServer jbs;
+ private IServer server;
private Label errorLabel;
- public XPathCategoryDialog(Shell parentShell, JBossServer jbs) {
+ public XPathCategoryDialog(Shell parentShell, IServer server) {
super(parentShell);
- this.jbs = jbs;
+ this.server = server;
}
- public XPathCategoryDialog(Shell parentShell, JBossServer jbs, String initialName) {
- this(parentShell, jbs);
+ public XPathCategoryDialog(Shell parentShell, IServer server, String initialName) {
+ this(parentShell, server);
this.initialName = initialName;
}
@@ -142,7 +143,7 @@
}
private void verifyText(String text) {
- boolean valid = !XPathModel.getDefault().containsCategory(jbs, text) || (initialName
!= null && initialName.equals(text));
+ boolean valid = !XPathModel.getDefault().containsCategory(server, text) ||
(initialName != null && initialName.equals(text));
if( valid ) {
errorLabel.setVisible(false);
currentText = text;
@@ -168,7 +169,7 @@
protected XPathProposalProvider proposalProvider;
- protected JBossServer server;
+ protected IServer server;
protected String name, xpath, attribute, category;
protected String originalName = null;
protected XPathQuery original = null;
@@ -183,14 +184,14 @@
public XPathDialog(Shell parentShell) {
this(parentShell, null);
}
- public XPathDialog(Shell parentShell, JBossServer server) {
+ public XPathDialog(Shell parentShell, IServer server) {
this(parentShell, server, null);
}
- public XPathDialog(Shell parentShell, JBossServer server, String categoryName) {
+ public XPathDialog(Shell parentShell, IServer server, String categoryName) {
this(parentShell, server, categoryName, null);
}
- public XPathDialog(Shell parentShell, JBossServer server, String categoryName, String
originalName) {
+ public XPathDialog(Shell parentShell, IServer server, String categoryName, String
originalName) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
this.category = categoryName;
@@ -233,22 +234,19 @@
if( xpath != null ) xpathText.setText(xpath);
proposalProvider = new XPathProposalProvider(repository);
- proposalProvider.setServer(server);
+ proposalProvider.setPath(getConfigFolder(server));
ContentProposalAdapter adapter = new
ContentProposalAdapter(xpathText, new TextContentAdapter(),
proposalProvider, null, null);
-
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-
XPathAttributeProposalProvider provider2 = new
XPathAttributeProposalProvider(repository, xpathText);
- provider2.setServer(server);
+ provider2.setPath(getConfigFolder(server));
ContentProposalAdapter adapter2 = new
ContentProposalAdapter(attributeText, new TextContentAdapter(),
provider2, null, null);
adapter2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-
return main;
}
@@ -301,10 +299,10 @@
public void widgetSelected(SelectionEvent e) {
int index = serverCombo.getSelectionIndex();
String val = serverCombo.getItem(index);
- JBossServer[] serverList = ServerConverter.getAllJBossServers();
- for( int i = 0; i < serverList.length; i++ ) {
- if( serverList[i].getServer().getName().equals(val)) {
- setServer(serverList[i]);
+ IServer[] list = ServerCore.getServers();
+ for( int i = 0; i < list.length; i++ ) {
+ if( list[i].getName().equals(val)) {
+ setServer(list[i]);
return;
}
}
@@ -380,7 +378,7 @@
return Messages.XPathNameEmpty;
}
if( server == null ) return null;
- XPathCategory[] categories =
XPathModel.getDefault().getCategories((JBossServer)server);
+ XPathCategory[] categories = XPathModel.getDefault().getCategories(server);
XPathCategory category = null;
for( int i = 0; i < categories.length; i++ ) {
if( categories[i].getName().equals(this.category))
@@ -401,9 +399,9 @@
}
- protected void setServer(JBossServer s) {
+ protected void setServer(IServer s) {
server = s;
- proposalProvider.setServer(s);
+ proposalProvider.setPath(getConfigFolder(s));
refreshCategoryCombo();
checkErrors();
}
@@ -428,7 +426,7 @@
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
final IProgressMonitor monitor2 = monitor;
- XPathQuery tmp = new XPathQuery("", server.getConfigDirectory(), null,
xpathText.getText(), attributeText.getText());
+ XPathQuery tmp = new XPathQuery("", getConfigFolder(server), null,
xpathText.getText(), attributeText.getText());
tmp.setRepository(repository);
final ArrayList list = new ArrayList();
list.addAll(Arrays.asList(tmp.getResults()));
@@ -627,7 +625,7 @@
public String getCategory() {
return category;
}
- public JBossServer getServer() {
+ public IServer getServer() {
return server;
}
@@ -681,7 +679,7 @@
}
public static class XPathProposalProvider implements IContentProposalProvider {
-
+
protected static final int NEW_ELEMENT = 1;
protected static final int NEW_ATTRIBUTE = 2;
protected static final int NEW_ATTRIBUTE_VALUE = 3;
@@ -690,8 +688,7 @@
protected static final int IN_ATTRIBUTE_VALUE = 6;
protected static final int CLOSE_ATTRIBUTE = 7;
-
- private IDeployableServer server;
+ private String path;
private HashMap xpathCache;
protected XMLDocumentRepository repository;
@@ -699,9 +696,11 @@
xpathCache = new HashMap();
this.repository = repository;
}
- public void setServer(IDeployableServer server) {
- this.server = server;
+
+ public void setPath(String path) {
+ this.path = path;
}
+
public IContentProposal[] getProposals(String contents, int position) {
if( contents.equals("") || contents.equals("/") ||
contents.equals(" ")) {
return new IContentProposal[] { new XPathContentProposal("/server/",
"/server/".length(), null, null)};
@@ -720,14 +719,14 @@
}
protected XPathResultNode[] getXPath(String xpath) {
- if( server == null )
+ if( path == null )
return new XPathResultNode[0];
if( xpathCache.containsKey(xpath)) {
ArrayList list = (ArrayList)xpathCache.get(xpath);
return (XPathResultNode[]) list.toArray(new XPathResultNode[list.size()]);
}
- XPathQuery tmp = new XPathQuery("", server.getConfigDirectory(),
"**/*.xml", xpath, null);
+ XPathQuery tmp = new XPathQuery("", path, "**/*.xml", xpath,
null);
tmp.setRepository(repository);
ArrayList list = new ArrayList();
XPathFileResult[] items = tmp.getResults();
@@ -774,9 +773,11 @@
String[] props = getAttributeNameProposalStrings(parent, path.substring(attName+1));
return convertProposals(props);
}
+
public IContentProposal[] getAttributeNameProposals(String parentPath, String
remainder) {
return convertProposals(getAttributeNameProposalStrings(parentPath, remainder));
}
+
public String[] getAttributeNameProposalStrings(String parentPath, String remainder) {
ArrayList names = new ArrayList();
XPathResultNode[] items = getXPath(parentPath);
@@ -799,6 +800,7 @@
public IContentProposal[] getAttributeValueProposals(String path) {
return getAttributeValueProposals(path.substring(0, path.lastIndexOf('=')),
path.substring(path.lastIndexOf('=')+1));
}
+
public IContentProposal[] getAttributeValueProposals(String parentPath, String
remainder) {
String parentElementPath = parentPath.substring(0,
parentPath.lastIndexOf('['));
int brackIndex = parentPath.lastIndexOf('[');
@@ -887,4 +889,13 @@
}
}
}
+
+ public static String getConfigFolder(IServer server) {
+ JBossServer jbs = (JBossServer)server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
+ if( jbs != null ) {
+ return jbs.getConfigDirectory();
+ }
+ return server.getRuntime().getLocation().toOSString();
+ //return null;
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -54,8 +54,6 @@
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathModel;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathQuery;
import org.jboss.ide.eclipse.as.core.model.descriptor.XPathFileResult.XPathResultNode;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs;
import org.jboss.ide.eclipse.as.ui.dialogs.XPathDialogs.XPathCategoryDialog;
@@ -75,7 +73,6 @@
editXPathAction, deleteXPathAction, editFileAction;
private IServer server;
- private JBossServer jbServer;
private XPathCategory activeCategory;
private Object selectedPropertyObject;
@@ -121,6 +118,7 @@
IWorkbenchWindow window = work.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
IViewReference ref = window.getActivePage().findViewReference(propsId);
+ if( ref == null ) return false;
IWorkbenchPart part = ref.getPart(false);
return ( part != null && page.isPartVisible(part));
}
@@ -146,8 +144,8 @@
public Object[] getChildren(Object parentElement) {
if( parentElement instanceof ServerViewProvider ) {
- if( jbServer == null ) return new Object[]{};
- return XPathModel.getDefault().getCategories(jbServer);
+ if( server == null ) return new Object[]{};
+ return XPathModel.getDefault().getCategories(server);
}
return new Object[0];
}
@@ -165,7 +163,6 @@
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if( oldInput != newInput ) {
server = (IServer)newInput;
- jbServer = server == null ? null : ServerConverter.getJBossServer(server);
}
}
}
@@ -199,11 +196,11 @@
public void createActions() {
newXPathCategoryAction = new Action() {
public void run() {
- XPathCategoryDialog d = new XPathDialogs.XPathCategoryDialog(
- Display.getCurrent().getActiveShell(), jbServer);
+ XPathCategoryDialog d = new XPathCategoryDialog(
+ Display.getCurrent().getActiveShell(), server);
if( d.open() == Window.OK ) {
- XPathModel.getDefault().addCategory(jbServer, d.getText());
- XPathModel.getDefault().save(jbServer);
+ XPathModel.getDefault().addCategory(server, d.getText());
+ XPathModel.getDefault().save(server);
refreshViewer();
}
}
@@ -217,8 +214,8 @@
messageBox.setText (Messages.DescriptorXPathRemoveCategory + "?");
messageBox.setMessage (Messages.DescriptorXPathRemoveCategoryDesc);
if( messageBox.open () == SWT.YES ) {
- XPathModel.getDefault().removeCategory(jbServer, getActiveCategory().getName());
- XPathModel.getDefault().save(jbServer);
+ XPathModel.getDefault().removeCategory(server, getActiveCategory().getName());
+ XPathModel.getDefault().save(server);
setActiveCategory(null);
refreshViewer();
}
@@ -232,18 +229,18 @@
XPathCategory category = getActiveCategory();
if( category != null ) {
String categoryName = category.getName();
- XPathDialog d = new XPathDialog(Display.getCurrent().getActiveShell(), jbServer,
categoryName);
+ XPathDialog d = new XPathDialog(Display.getCurrent().getActiveShell(), server,
categoryName);
if( d.open() == Window.OK ) {
- XPathCategory[] categoryList = XPathModel.getDefault().getCategories(jbServer);
+ XPathCategory[] categoryList = XPathModel.getDefault().getCategories(server);
XPathCategory categoryItem = null;
for( int i = 0; i < categoryList.length; i++ ) {
if( categoryList[i].getName().equals(category.getName()))
categoryItem = categoryList[i];
}
if( categoryItem != null ) {
- XPathQuery query = new XPathQuery(d.getName(), jbServer.getConfigDirectory(),
null, d.getXpath(), d.getAttribute());
+ XPathQuery query = new XPathQuery(d.getName(),
XPathDialogs.getConfigFolder(server), null, d.getXpath(), d.getAttribute());
categoryItem.addQuery(query);
- XPathModel.getDefault().save(jbServer);
+ XPathModel.getDefault().save(server);
refreshViewer();
}
}
@@ -260,7 +257,7 @@
XPathCategory category = original.getCategory();
XPathDialog d = new XPathDialog(Display.getCurrent().getActiveShell(),
- jbServer, category.getName(), original.getName());
+ server, category.getName(), original.getName());
d.setAttribute(original.getAttribute());
d.setXpath(original.getXpathPattern());
@@ -341,6 +338,10 @@
}
}
+ protected boolean supports(IServer server) {
+ return true;
+ }
+
// Property Sheet Page
public IPropertySheetPage getPropertySheetPage() {
if( propertyPage == null ) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/ModuleViewProvider.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -33,8 +33,6 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerLifecycleListener;
@@ -42,6 +40,7 @@
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerEvent;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.eclipse.wst.server.ui.ServerUICore;
import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
@@ -57,15 +56,11 @@
private ModuleContentProvider contentProvider;
private ModuleLabelProvider labelProvider;
-
- private Action deleteModuleAction, publishModuleAction;
-
+ private Action deleteModuleAction, fullPublishModuleAction,
incrementalPublishModuleAction;
private ModuleServer selection;
-
private IServerLifecycleListener serverResourceListener;
private IServerListener serverListener;
-
public ModuleViewProvider() {
contentProvider = new ModuleContentProvider();
labelProvider = new ModuleLabelProvider();
@@ -78,13 +73,16 @@
public void run() {
if (MessageDialog.openConfirm(new Shell(), Messages.ServerDialogHeading,
Messages.DeleteModuleConfirm)) {
try {
- IServerWorkingCopy wc = selection.server.createWorkingCopy();
- wc.modifyModules(null, selection.module , null);
- wc.save(true, null);
- // Re-publish in case the configuration change has not been published yet.
- DeployableServerBehavior behavior = (DeployableServerBehavior)
- contentProvider.getServer().loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
- behavior.publishOneModule(IServer.PUBLISH_FULL, selection.module,
ServerBehaviourDelegate.REMOVED, new NullProgressMonitor());
+ IServerWorkingCopy server = selection.server.createWorkingCopy();
+ ServerUtil.modifyModules(server, null, selection.module, new
NullProgressMonitor());
+ IServer server2 = server.save(true, null);
+
+ if( ServerConverter.getDeployableServer(selection.server) != null ) {
+ ServerConverter.getDeployableServerBehavior(selection.server)
+ .publishOneModule(IServer.PUBLISH_FULL, selection.module,
ServerBehaviourDelegate.REMOVED, new NullProgressMonitor());
+ } else {
+ server2.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
+ }
} catch (Exception e) {
// ignore
}
@@ -95,24 +93,47 @@
deleteModuleAction.setDescription(Messages.DeleteModuleDescription);
deleteModuleAction.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.UNPUBLISH_IMAGE));
- publishModuleAction = new Action() {
+ fullPublishModuleAction = new Action() {
public void run() {
- DeployableServerBehavior behavior = (DeployableServerBehavior)
- contentProvider.getServer().loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
- if( behavior != null )
- behavior.publishOneModule(IServer.PUBLISH_FULL, selection.module,
ServerBehaviourDelegate.CHANGED, new NullProgressMonitor());
+ actionPublish(IServer.PUBLISH_FULL);
}
};
- publishModuleAction.setText(Messages.PublishModuleText);
- publishModuleAction.setDescription(Messages.PublishModuleDescription);
- publishModuleAction.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.PUBLISH_IMAGE));
+ fullPublishModuleAction.setText(Messages.PublishModuleText);
+ fullPublishModuleAction.setDescription(Messages.PublishModuleDescription);
+ fullPublishModuleAction.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.PUBLISH_IMAGE));
+
+
+ incrementalPublishModuleAction = new Action() {
+ public void run() {
+ actionPublish(IServer.PUBLISH_INCREMENTAL);
+ }
+ };
+ incrementalPublishModuleAction.setText("Incremental Publish");
+ incrementalPublishModuleAction.setDescription(Messages.PublishModuleDescription);
+ incrementalPublishModuleAction.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.PUBLISH_IMAGE));
+}
+
+ protected void actionPublish(int type) {
+ try {
+ if( ServerConverter.getDeployableServer(selection.server) != null ) {
+ ServerConverter.getDeployableServerBehavior(selection.server)
+ .publishOneModule(type, selection.module,
+ ServerBehaviourDelegate.CHANGED, new NullProgressMonitor());
+ } else {
+ selection.server.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
+ }
+ } catch( Exception e ) {
+ // ignore
+ }
}
+
public void fillContextMenu(Shell shell, IMenuManager menu, Object selection) {
if( selection instanceof ModuleServer) {
this.selection = (ModuleServer)selection;
menu.add(deleteModuleAction);
- menu.add(publishModuleAction);
+ menu.add(fullPublishModuleAction);
+ menu.add(incrementalPublishModuleAction);
}
}
@@ -269,7 +290,5 @@
servers[i].getServer().addServerListener(serverListener);
}
}
-
-
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2007-08-15
17:01:23 UTC (rev 3149)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/StrippedServerWizardFragment.java 2007-08-15
17:01:59 UTC (rev 3150)
@@ -2,11 +2,9 @@
import java.io.File;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -27,12 +25,12 @@
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerType;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.ide.eclipse.as.core.server.stripped.DeployableServer;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
import org.jboss.ide.eclipse.as.ui.Messages;
public class StrippedServerWizardFragment extends WizardFragment {
@@ -43,6 +41,7 @@
private Text deployText, nameText;
private Button browse;
private String name, deployLoc;
+
public StrippedServerWizardFragment() {
}
@@ -50,17 +49,14 @@
this.handle = handle;
Composite main = new Composite(parent, SWT.NONE);
main.setLayout(new FormLayout());
-
-
-
-
+
nameLabel = new Label(main, SWT.NONE);
nameText = new Text(main, SWT.BORDER);
nameLabel.setText("Server Name");
deployLabel = new Label(main, SWT.NONE);
deployText = new Text(main, SWT.BORDER);
- Button browse = new Button(main, SWT.PUSH);
+ browse = new Button(main, SWT.PUSH);
deployLabel.setText(Messages.deployDirectory);
browse.setText(Messages.browse);
@@ -85,12 +81,7 @@
nametData.left = new FormAttachment(deployLabel,5);
nametData.right = new FormAttachment(100,-5);
nameText.setLayoutData(nametData);
-
-
-
-
-
FormData bData = new FormData();
bData.right = new FormAttachment(100,-5);
bData.top = new FormAttachment(nameText,5);
@@ -114,13 +105,10 @@
}
});
-
deployText.addModifyListener(ml);
nameText.addModifyListener(ml);
-
nameText.setText(getDefaultNameText());
-
-
+ handle.setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.WIZBAN_DEPLOY_ONLY_LOGO));
return main;
}
@@ -184,26 +172,14 @@
IServerWorkingCopy serverWC = (IServerWorkingCopy)
getTaskModel().getObject(TaskModel.TASK_SERVER);
ServerWorkingCopy serverwc2 = (serverWC instanceof ServerWorkingCopy ?
((ServerWorkingCopy)serverWC) : null);
- IFolder folder = getJbossServerFolder(name);
- if( !folder.exists()) {
- folder.create(true,true, new NullProgressMonitor());
- }
try {
- serverwc2.setServerConfiguration(folder);
+ serverwc2.setServerConfiguration(null);
serverwc2.setName(name);
serverwc2.setAttribute(DeployableServer.DEPLOY_DIRECTORY, deployLoc);
- IServer saved = serverwc2.save(true, monitor);
- getTaskModel().putObject(TaskModel.TASK_SERVER, saved);
+ getTaskModel().putObject(TaskModel.TASK_SERVER, serverwc2);
} catch( Exception ce ) {
}
}
- private IFolder getJbossServerFolder(String serverName) {
- try {
- return ServerType.getServerProject().getFolder(serverName);
- } catch( Exception e) {
- return null;
- }
- }
public boolean isComplete() {
return checkErrors().isOK();
@@ -212,19 +188,16 @@
public boolean hasComposite() {
return true;
}
-
-
-
-
private String getDefaultNameText() {
String base = "JBoss deployer";
if( findServer(base) == null ) return base;
int i = 1;
- while( ServerCore.findServer(base + " " + i) != null )
+ while( ServerCore.findServer(base + " (" + i + ")") != null )
i++;
- return base + " " + i;
+ return base + " (" + i + ")";
}
+
private IServer findServer(String name) {
IServer[] servers = ServerCore.getServers();
for( int i = 0; i < servers.length; i++ ) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-08-15 17:01:23 UTC (rev
3149)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2007-08-15 17:01:59 UTC (rev
3150)
@@ -107,24 +107,6 @@
- <extension
- id="org.jboss.ide.eclipse.as.ui.actionSet"
- name="JBoss AS"
- point="org.eclipse.ui.actionSets">
- <actionSet
- id="org.jboss.ide.eclipse.as.ui.actionSet.workbenchMenu"
- label="JBoss AS"
- visible="true">
- <action
-
class="org.jboss.ide.eclipse.as.ui.actions.ServerPulldownDelegate"
- icon="icons/jboss.gif"
- id="org.jboss.ide.eclipse.as.ui.actions.ServerPulldownShortcut"
- label="JBoss AS Menu"
- style="pulldown"
- toolbarPath="Normal/additions"
- tooltip="Start Server"/>
- </actionSet>
- </extension>