JBoss Tools SVN: r3476 - trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-06 15:24:39 -0400 (Thu, 06 Sep 2007)
New Revision: 3476
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
Log:
view was left with items in it when selected project was deleted
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2007-09-06 16:32:54 UTC (rev 3475)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2007-09-06 19:24:39 UTC (rev 3476)
@@ -207,10 +207,12 @@
if( root != null ) {
List list = Arrays.asList( getRoot(project, register, monitor).getAllChildren());
return (IArchive[]) list.toArray(new IArchive[list.size()]);
- } else {
+ } else if( register) {
registerProject(project, monitor);
List list = Arrays.asList( getRoot(project, register, monitor).getAllChildren());
return (IArchive[]) list.toArray(new IArchive[list.size()]);
+ } else {
+ return new IArchive[] {};
}
}
16 years, 8 months
JBoss Tools SVN: r3475 - in trunk/seam/tests/org.jboss.tools.seam.ui.test: src/org/jboss/tools/seam/ui/test/view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2007-09-06 12:32:54 -0400 (Thu, 06 Sep 2007)
New Revision: 3475
Added:
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.1
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.2
trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.3
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
Log:
http://jira.jboss.com/jira/browse/EXIN-337
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.1
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.1 (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.1 2007-09-06 16:32:54 UTC (rev 3475)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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 demo;
+
+import javax.persistence.Entity;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+
+/**
+ * Created by Red Hat Developer Studio
+ */
+
+@Name("demo.John")
+(a)Scope(ScopeType.APPLICATION)
+@Entity
+(a)Install(precedence=Install.FRAMEWORK)
+
+public class Person {
+
+ private String name;
+
+ @Out
+ private String address = "";
+
+ @In
+ private String payment = "";
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPayment() {
+ return payment;
+ }
+
+ @Unwrap
+ public void unwrapMethod() {
+ }
+
+ @Create @Destroy
+ public void createAndDestroyMethod() {
+ }
+
+ @Factory(value="myFactory", scope=ScopeType.SESSION)
+ public void testFactory() {
+
+ }
+
+}
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.2
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.2 (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.2 2007-09-06 16:32:54 UTC (rev 3475)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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 demo;
+
+import javax.persistence.Entity;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+
+/**
+ * Created by Red Hat Developer Studio
+ */
+
+@Name("demo.Pall")
+(a)Scope(ScopeType.APPLICATION)
+@Entity
+(a)Install(precedence=Install.FRAMEWORK)
+
+public class Person {
+
+ private String name;
+
+ @Out
+ private String address = "";
+
+ @In
+ private String payment = "";
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPayment() {
+ return payment;
+ }
+
+ @Unwrap
+ public void unwrapMethod() {
+ }
+
+ @Create @Destroy
+ public void createAndDestroyMethod() {
+ }
+
+ @Factory(value="myFactory", scope=ScopeType.SESSION)
+ public void testFactory() {
+
+ }
+
+}
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.3
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.3 (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/projects/TestComponentView/JavaSource/demo/Person.3 2007-09-06 16:32:54 UTC (rev 3475)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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 demo;
+
+import javax.persistence.Entity;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.*;
+
+/**
+ * Created by Red Hat Developer Studio
+ */
+
+@Name("beatles.Pall")
+(a)Scope(ScopeType.APPLICATION)
+@Entity
+(a)Install(precedence=Install.FRAMEWORK)
+
+public class Person {
+
+ private String name;
+
+ @Out
+ private String address = "";
+
+ @In
+ private String payment = "";
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getPayment() {
+ return payment;
+ }
+
+ @Unwrap
+ public void unwrapMethod() {
+ }
+
+ @Create @Destroy
+ public void createAndDestroyMethod() {
+ }
+
+ @Factory(value="myFactory", scope=ScopeType.SESSION)
+ public void testFactory() {
+
+ }
+
+}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-06 15:43:10 UTC (rev 3474)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-06 16:32:54 UTC (rev 3475)
@@ -48,7 +48,8 @@
*/
public class SeamComponentsViewTest extends TestCase {
IProject project;
- IFile file;
+ IFile componentsFile;
+ IFile classFile;
@Override
protected void setUp() throws Exception {
@@ -63,14 +64,18 @@
JUnitUtils.fail("Cannot create Project Provider", e1);
}
project = provider.getProject();
- file = project.getFile("WebContent/WEB-INF/components.xml");
- assertTrue("Cannot find components.xml in test project", file != null && file.exists());
+ componentsFile = project.getFile("WebContent/WEB-INF/components.xml");
+ assertTrue("Cannot find components.xml in test project", componentsFile != null && componentsFile.exists());
}
public void testComponentView(){
addComponent();
renameComponent();
deleteComponent();
+
+ addClass();
+ renameClass();
+ deleteClass();
}
public void addComponent(){
@@ -94,7 +99,7 @@
assertTrue("Cannot find components.1 in test project", file1 != null && file1.exists());
try{
- file.setContents(file1.getContents(), false, false, new NullProgressMonitor());
+ componentsFile.setContents(file1.getContents(), false, false, new NullProgressMonitor());
}catch(Exception ex){
JUnitUtils.fail("Cannot read file WebContent/WEB-INF/components.1", ex);
}
@@ -133,7 +138,7 @@
assertTrue("Cannot find components.2 in test project", file1 != null && file1.exists());
try{
- file.setContents(file1.getContents(), false, false, new NullProgressMonitor());
+ componentsFile.setContents(file1.getContents(), false, false, new NullProgressMonitor());
}catch(Exception ex){
JUnitUtils.fail("Cannot read file WebContent/WEB-INF/components.2", ex);
}
@@ -156,7 +161,7 @@
assertTrue("Cannot find components.3 in test project", file2 != null && file2.exists());
try{
- file.setContents(file2.getContents(), false, false, new NullProgressMonitor());
+ componentsFile.setContents(file2.getContents(), false, false, new NullProgressMonitor());
}catch(Exception ex){
JUnitUtils.fail("Cannot read file WebContent/WEB-INF/components.3", ex);
}
@@ -200,7 +205,7 @@
assertTrue("Cannot find components.2 in test project", file1 != null && file1.exists());
try{
- file.setContents(file1.getContents(), false, false, new NullProgressMonitor());
+ componentsFile.setContents(file1.getContents(), false, false, new NullProgressMonitor());
}catch(Exception ex){
JUnitUtils.fail("Cannot read file WebContent/WEB-INF/components.4", ex);
}
@@ -227,6 +232,148 @@
}
+ public void addClass(){
+
+ classFile = project.getFile("JavaSource/demo/Person.java");
+ assertTrue("Cannot find Person.java in test project", componentsFile != null);
+
+
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot build test Project", e);
+ }
+
+ CommonNavigator navigator = getSeamComponentsView();
+ navigator.getCommonViewer().expandAll();
+
+ Tree tree = navigator.getCommonViewer().getTree();
+
+ ISeamPackage seamPackage = findSeamPackage(tree, "demo");
+ assertTrue("Package \"demo\" found!",seamPackage==null);
+
+ IFile file1 = project.getFile("JavaSource/demo/Person.1");
+ assertTrue("Cannot find Person.1 in test project", file1 != null && file1.exists());
+
+ try{
+ classFile.create(file1.getContents(), false, new NullProgressMonitor());
+ }catch(Exception ex){
+ JUnitUtils.fail("Cannot read file JavaSource/demo/Person.1", ex);
+ }
+
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot build test Project", e);
+ }
+
+ seamPackage = findSeamPackage(tree, "demo");
+ assertTrue("Package \"demo\" not found!",seamPackage!=null);
+
+ if(seamPackage != null){
+ ISeamComponent component = findSeamComponent(seamPackage, "demo.John");
+ assertTrue("Component \"demo.John\" not found!",component!=null);
+ }
+
+ }
+
+ private void renameClass(){
+ CommonNavigator navigator = getSeamComponentsView();
+ navigator.getCommonViewer().expandAll();
+
+ Tree tree = navigator.getCommonViewer().getTree();
+
+ ISeamPackage seamPackage = findSeamPackage(tree, "demo");
+ assertTrue("Package \"demo\" not found!",seamPackage!=null);
+
+ if(seamPackage != null){
+ ISeamComponent component = findSeamComponent(seamPackage, "demo.John");
+ assertTrue("Component \"demo.John\" not found!",component!=null);
+ }
+
+ IFile file1 = project.getFile("JavaSource/demo/Person.2");
+ assertTrue("Cannot find Person.2 in test project", file1 != null && file1.exists());
+
+ try{
+ classFile.setContents(file1.getContents(), false, false, new NullProgressMonitor());
+ }catch(Exception ex){
+ JUnitUtils.fail("Cannot read file JavaSource/demo/Person.1", ex);
+ }
+
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot build test Project", e);
+ }
+
+ seamPackage = findSeamPackage(tree, "demo");
+ assertTrue("Package \"demo\" not found!",seamPackage!=null);
+ if(seamPackage != null){
+ ISeamComponent component = findSeamComponent(seamPackage, "demo.John");
+ assertTrue("Component \"demo.John\" found!",component==null);
+
+ component = findSeamComponent(seamPackage, "demo.Pall");
+ assertTrue("Component \"demo.Pall\" not found!",component!=null);
+ }
+
+ IFile file2 = project.getFile("JavaSource/demo/Person.3");
+ assertTrue("Cannot find Person.3 in test project", file2 != null && file2.exists());
+
+ try{
+ classFile.setContents(file2.getContents(), false, false, new NullProgressMonitor());
+ }catch(Exception ex){
+ JUnitUtils.fail("Cannot read file JavaSource/demo/Person.3", ex);
+ }
+
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot build test Project", e);
+ }
+
+ seamPackage = findSeamPackage(tree, "demo");
+ assertTrue("Package \"demo\" found!",seamPackage==null);
+
+ seamPackage = findSeamPackage(tree, "beatles");
+ assertTrue("Package \"beatles\" not found!",seamPackage!=null);
+
+ if(seamPackage != null){
+ ISeamComponent component = findSeamComponent(seamPackage, "beatles.Pall");
+ assertTrue("Component \"beatles.Pall\" not found!",component!=null);
+ }
+
+ }
+
+ private void deleteClass(){
+ CommonNavigator navigator = getSeamComponentsView();
+ navigator.getCommonViewer().expandAll();
+
+ Tree tree = navigator.getCommonViewer().getTree();
+
+ ISeamPackage seamPackage = findSeamPackage(tree, "beatles");
+ assertTrue("Package \"beatles\" not found!",seamPackage!=null);
+
+ if(seamPackage != null){
+ ISeamComponent component = findSeamComponent(seamPackage, "beatles.Pall");
+ assertTrue("Component \"beatles.Pall\" not found!",component!=null);
+ }
+
+ try{
+ classFile.delete(false, new NullProgressMonitor());
+ }catch(Exception ex){
+ JUnitUtils.fail("Cannot delete file JavaSource/demo/Person.java", ex);
+ }
+
+ try {
+ project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ } catch (Exception e) {
+ JUnitUtils.fail("Cannot build test Project", e);
+ }
+
+ seamPackage = findSeamPackage(tree, "beatles");
+ assertTrue("Package \"beatles\" found!",seamPackage==null);
+ }
+
/**
*
*/
16 years, 8 months
JBoss Tools SVN: r3474 - in branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner: editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2007-09-06 11:43:10 -0400 (Thu, 06 Sep 2007)
New Revision: 3474
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-744, some code was adjusted
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2007-09-06 15:43:03 UTC (rev 3473)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java 2007-09-06 15:43:10 UTC (rev 3474)
@@ -160,6 +160,7 @@
private void onFocusGained() {
nsIWebBrowserFocus webBrowserFocus = (nsIWebBrowserFocus) webBrowser.queryInterface(nsIWebBrowserFocus.NS_IWEBBROWSERFOCUS_IID);
webBrowserFocus.activate();
+ webBrowserFocus.setFocusAtFirstElement();
}
private void onFocusLost() {
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-09-06 15:43:03 UTC (rev 3473)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerEditor.java 2007-09-06 15:43:10 UTC (rev 3474)
@@ -502,7 +502,7 @@
nsIDOMWindow domWindow = getWebBrowser().getContentDOMWindow();
// get element positions on visual page
Rectangle rect=XulRunnerVpeUtils.getElementBounds(element);
- domWindow.scrollTo(rect.x, rect.y);
+ domWindow.scrollTo(rect.x-10, rect.y-10);
}
}
16 years, 8 months
JBoss Tools SVN: r3473 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2007-09-06 11:43:03 -0400 (Thu, 06 Sep 2007)
New Revision: 3473
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-744, some code was adjusted
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-09-06 15:23:25 UTC (rev 3472)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-09-06 15:43:03 UTC (rev 3473)
@@ -12,7 +12,6 @@
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIClipboardDragDropHooks;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMEvent;
import org.mozilla.interfaces.nsIDOMEventListener;
@@ -27,8 +26,7 @@
import org.mozilla.xpcom.Mozilla;
-class MozillaDomEventListener implements nsIClipboardDragDropHooks,
- nsIDOMEventListener, nsISelectionListener {
+class MozillaDomEventListener implements nsIDOMEventListener, nsISelectionListener {
// TODO Max Areshkau add DnD
// private XPCOMObject dropListener;
@@ -62,46 +60,6 @@
public static final String DRAGEXITEVENT = "dragexit";
- public MozillaDomEventListener() {
- createCOMInterfaces();
- }
-
- void createCOMInterfaces() {
-
- // TODO Max Areshkau add DnD
- // VpeDnD
-// dropListener = new XPCOMObject(new int[]{2,0,0,4,4,3,6,5}) {
-// public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
-// public int method1(int[] args) {return AddRef();}
-// public int method2(int[] args) {return Release();}
-// public int method3(int[] args) {return CanDrag(args[0], args[1], args[2], args[3]);}
-// public int method4(int[] args) {return CanDrop(args[0], args[1], args[2], args[3]);}
-// public int method5(int[] args) {return Drop(args[0], args[1], args[2]);}
-// public int method6(int[] args) {return CanDropExternal(args[0], args[1], args[2], args[3], args[4], args[5]);}
-// public int method7(int[] args) {return DropExternal(args[0], args[1], args[2], args[3], args[4]);}
-// };
-//
-// dnd = getDnD();
- }
-
- void disposeCOMInterfaces() {
- // TODO Max Areshakau add DnD
-// if (dropListener != null) {
-// dropListener.dispose();
-// dropListener = null;
-// }
- }
-
- // TODO Max Areshkau add DnD support
-// XPCOMObject getDropListener() {
-// return dropListener;
-// }
-
- // TODO Max Areshkau add DnD support
-// VpeDnD getLocalDnD() {
-// return dnd;
-// }
-
void setEditorDomEventListener(EditorDomEventListener listener) {
editorDomEventListener = listener;
}
@@ -116,125 +74,7 @@
return editorDomEventListener;
}
- // TODO Max Areshkau add DnD support
-// VpeDnD getDnD() {
-// int[] result = new int[] {0};
-// int rc = XPCOM.NS_GetComponentManager(result);
-// if (rc != XPCOM.NS_OK) {
-// VpePlugin.getPluginLog().logError("(DND) GetComponentManager error " + rc);
-// }
-// if (result[0] == 0) {
-// VpePlugin.getPluginLog().logError("(DND) GetComponentManager error NO_INTERFACE");
-// }
-//
-// nsIComponentManager componentManager = new nsIComponentManager(result[0]);
-// result[0] = 0;
-// rc = componentManager.CreateInstance(XPCOM.VPE_DND_CID, 0, VpeDnD.VPE_DND_IID, result);
-// if (rc != XPCOM.NS_OK) {
-// VpePlugin.getPluginLog().logError("(DND) Create instance error " + rc);
-// }
-// if (result[0] == 0) {
-// VpePlugin.getPluginLog().logError("(DND) Create instance error NO_INTERFACE");
-// }
-// componentManager.Release();
-//
-// return new VpeDnD(result[0]);
-// }
-//
-// // IVpeDropListener
- //generates when drag event exist
-// int CanDrag(int aDragEvent, int _retval, int aNode, int offset) {
-// int canDrag = 0;
-//
-// nsIDOMMouseEvent mouseEvent = nsIDOMEvent.queryMouseEvent(aDragEvent);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-// boolean canDragFlag = editorDomEventListener.canInnerDrag(mouseEvent);
-// canDrag = canDragFlag ? 1 : 0;
-// }
-// XPCOM.memmove(_retval, new int[] {canDrag}, 4);
-// XPCOM.memmove(aNode, new int[] {0}, 4);
-// XPCOM.memmove(offset, new int[] {0}, 4);
-// return XPCOM.NS_OK;
-// }
-//
-// int CanDrop(int aDropEvent, int _retval, int aNode, int offset) {
-// int canDrop = 0;
-// int aCaretParent = 0;
-// int caretOffset = 0;
-//
-// nsIDOMMouseEvent mouseEvent = nsIDOMEvent.queryMouseEvent(aDropEvent);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-//// nsIDOMNode visualNode = mouseEvent.getTargetNode();
-// MozillaDropInfo info = editorDomEventListener.canInnerDrop(mouseEvent);
-// if (info != null && info.canDrop()) {
-// canDrop = 1;
-// Node caretParent = info.getCaretParent();
-// if (caretParent != null) {
-// MozillaSupports.addRef(caretParent);
-// aCaretParent = MozillaSupports.getAddress(caretParent);
-// caretOffset = info.getCaretOffset();
-// }
-// }
-// }
-// XPCOM.memmove(_retval, new int[] {canDrop}, 4);
-// XPCOM.memmove(aNode, new int[] {aCaretParent}, 4);
-// XPCOM.memmove(offset, new int[] {caretOffset}, 4);
-// return XPCOM.NS_OK;
-// }
-//
-// int Drop(int aDropEvent, int aNode, int offset) {
-// nsIDOMMouseEvent mouseEvent = nsIDOMEvent.queryMouseEvent(aDropEvent);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-// editorDomEventListener.innerDrop(mouseEvent);
-// }
-// XPCOM.memmove(aNode, new int[] {0}, 4);
-// XPCOM.memmove(offset, new int[] {0}, 4);
-// return XPCOM.NS_OK;
-// }
-// generates on external drop event
-// int CanDropExternal(int aDropEvent, int aFlavor, int aTransData, int _retval, int aNode, int offset) {
-// int canDrop = 0;
-// int aCaretParent = 0;
-// int caretOffset = 0;
-//
-// nsIDOMMouseEvent mouseEvent = nsIDOMEvent.queryMouseEvent(aDropEvent);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-// String flavor = new nsString(aFlavor).toString();
-// String data = new nsString(aTransData).toString();
-// MozillaDropInfo info = editorDomEventListener.canExternalDrop(mouseEvent, flavor, data);
-// if (info != null) {
-// canDrop = info.canDrop() ? 1 : 0;
-// Node caretParent = info.getCaretParent();
-// if (caretParent != null) {
-// MozillaSupports.addRef(caretParent);
-// aCaretParent = MozillaSupports.getAddress(caretParent);
-// caretOffset = info.getCaretOffset();
-// }
-// }
-// }
-// XPCOM.memmove(_retval, new int[] {canDrop}, 4);
-// XPCOM.memmove(aNode, new int[] {aCaretParent}, 4);
-// XPCOM.memmove(offset, new int[] {caretOffset}, 4);
-// return XPCOM.NS_OK;
-// }
-//
-// int DropExternal(int aDropEvent, int aFlavor, int aTransData, int aNode, int offset) {
-// nsIDOMMouseEvent mouseEvent = nsIDOMEvent.queryMouseEvent(aDropEvent);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-// String flavor = new nsString(aFlavor).toString();
-// String data = new nsString(aTransData).toString();
-// editorDomEventListener.externalDrop(mouseEvent, flavor, data);
-// }
-// XPCOM.memmove(aNode, new int[] {0}, 4);
-// XPCOM.memmove(offset, new int[] {0}, 4);
-//// return XPCOM.NS_OK;
-// return XPCOM.NS_ERROR_ABORT;
-// }
+
boolean isXulElement(nsIDOMMouseEvent mouseEvent) {
// TODO Sergey Vasilyev figure out with getTmpRealOriginalTarget
@@ -255,53 +95,7 @@
this.visualEditor = visualEditor;
}
- /*-------------------------------------------*\
- * nsIClipboardDragDropHooks implementation *
- *-------------------------------------------*/
-
/* (non-Javadoc)
- * @see org.mozilla.interfaces.nsIClipboardDragDropHooks#allowDrop(org.mozilla.interfaces.nsIDOMEvent, org.mozilla.interfaces.nsIDragSession)
- */
- // checks is drop allowed
- @Deprecated
- // functionality was moved to VpeDnD.dragOver
- public boolean allowDrop(nsIDOMEvent event, nsIDragSession dragSession) {
- boolean canDrop = false;
-// nsIDOMMouseEvent mouseEvent = (nsIDOMMouseEvent) event.queryInterface(nsIDOMMouseEvent.NS_IDOMMOUSEEVENT_IID);
-//
-// if (editorDomEventListener != null && !isXulElement(mouseEvent)) {
-// if (dragSession.isDataFlavorSupported(VpeController.MODEL_FLAVOR)) {
-// MozillaDropInfo info = editorDomEventListener.canExternalDrop(mouseEvent, VpeController.MODEL_FLAVOR, "");
-// if (info != null && info.canDrop()) {
-// // TODO Sergey Vasilyev figures out with this drop
-// String nodeName = info.getCaretParent().getNodeName();
-// if ("input".equalsIgnoreCase(nodeName)) {
-// canDrop = true;
-// }
-// }
-// }
-// }
-// mouseEvent.preventDefault();
-// mouseEvent.stopPropagation();
-//
- return canDrop;
- }
-
- /* (non-Javadoc)
- * @see org.mozilla.interfaces.nsIClipboardDragDropHooks#allowStartDrag(org.mozilla.interfaces.nsIDOMEvent)
- */
- public boolean allowStartDrag(nsIDOMEvent arg0) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.mozilla.interfaces.nsIClipboardDragDropHooks#onCopyOrDrag(org.mozilla.interfaces.nsIDOMEvent, org.mozilla.interfaces.nsITransferable)
- */
- public boolean onCopyOrDrag(nsIDOMEvent arg0, nsITransferable arg1) {
- return true;
- }
-
- /* (non-Javadoc)
* @see org.mozilla.interfaces.nsIClipboardDragDropHooks#onPasteOrDrop(org.mozilla.interfaces.nsIDOMEvent, org.mozilla.interfaces.nsITransferable)
*/
public boolean onPasteOrDrop(nsIDOMEvent event, nsITransferable transferable) {
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-09-06 15:23:25 UTC (rev 3472)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-09-06 15:43:03 UTC (rev 3473)
@@ -53,7 +53,6 @@
import org.jboss.tools.vpe.editor.toolbar.format.TextFormattingToolBar;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.selbar.SelectionBar;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIClipboardDragDropHookList;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -548,7 +547,7 @@
private void addClipboardDragDropHooks() {
if (contentAreaEventListener != null) {
nsIClipboardDragDropHookList hookList = xulRunnerEditor.getClipboardDragDropHookList();
- hookList.addClipboardDragDropHooks(contentAreaEventListener);
+// hookList.addClipboardDragDropHooks(contentAreaEventListener);
} else if (baseEventListener != null) {
nsIClipboardDragDropHookList hookList = xulRunnerEditor.getClipboardDragDropHookList();
hookList.addClipboardDragDropHooks(baseEventListener);
@@ -558,7 +557,7 @@
private void removeClipboardDragDropHooks() {
if (contentAreaEventListener != null) {
nsIClipboardDragDropHookList hookList = xulRunnerEditor.getClipboardDragDropHookList();
- hookList.removeClipboardDragDropHooks(contentAreaEventListener);
+// hookList.removeClipboardDragDropHooks(contentAreaEventListener);
} else if (baseEventListener != null) {
nsIClipboardDragDropHookList hookList = xulRunnerEditor.getClipboardDragDropHookList();
hookList.removeClipboardDragDropHooks(baseEventListener);
16 years, 8 months
JBoss Tools SVN: r3472 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2007-09-06 11:23:25 -0400 (Thu, 06 Sep 2007)
New Revision: 3472
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
Log:
JBIDE-881
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-09-06 15:07:17 UTC (rev 3471)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/JavaScanner.java 2007-09-06 15:23:25 UTC (rev 3472)
@@ -84,7 +84,10 @@
if(u == null) return null;
ASTRequestorImpl requestor = new ASTRequestorImpl(f);
ICompilationUnit[] us = new ICompilationUnit[]{u};
- ASTParser.newParser(AST.JLS3).createASTs(us, new String[0], requestor, null);
+ ASTParser p = ASTParser.newParser(AST.JLS3);
+ p.setSource(u);
+ p.setResolveBindings(true);
+ p.createASTs(us, new String[0], requestor, null);
return requestor.getDeclarations();
}
@@ -159,3 +162,4 @@
}
}
+//:Pserver:anonymous@anoncvs.forge.jboss.com:/cvsroot/jboss
\ No newline at end of file
16 years, 8 months
JBoss Tools SVN: r3471 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: ayukhovich
Date: 2007-09-06 11:07:17 -0400 (Thu, 06 Sep 2007)
New Revision: 3471
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-742
Restoring functionality of resizing
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-06 14:08:53 UTC (rev 3470)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-06 15:07:17 UTC (rev 3471)
@@ -760,7 +760,9 @@
} else if (HTML.TAG_OPTION.equalsIgnoreCase(visualElementName)) {
updateElement(sourceElement.getParentNode());
return;
- }
+ } else if (HTML.TAG_INPUT.equalsIgnoreCase(visualElementName)) {
+ updateElement(sourceElement);
+ }
}
setXmlnsAttribute(elementMapping, name, value);
template.setAttribute(pageContext, sourceElement, visualDocument, visualElement, elementMapping.getData(), name, value);
16 years, 8 months
JBoss Tools SVN: r3470 - trunk/documentation/qa.
by jbosstools-commits@lists.jboss.org
Author: aklimkovich
Date: 2007-09-06 10:08:53 -0400 (Thu, 06 Sep 2007)
New Revision: 3470
Added:
trunk/documentation/qa/QA test report Build RF3.1.0 RC1.xls
trunk/documentation/qa/QA test report Build RF3.1.0 RC2.xls
trunk/documentation/qa/QA test report Build RF3.1.0 RC3.xls
trunk/documentation/qa/QA test report Build RF3.1.0 RC4.xls
Log:
Added: trunk/documentation/qa/QA test report Build RF3.1.0 RC1.xls
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/QA test report Build RF3.1.0 RC1.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/qa/QA test report Build RF3.1.0 RC2.xls
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/QA test report Build RF3.1.0 RC2.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/qa/QA test report Build RF3.1.0 RC3.xls
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/QA test report Build RF3.1.0 RC3.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/documentation/qa/QA test report Build RF3.1.0 RC4.xls
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/QA test report Build RF3.1.0 RC4.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 8 months
JBoss Tools SVN: r3469 - trunk/documentation/qa.
by jbosstools-commits@lists.jboss.org
Author: aklimkovich
Date: 2007-09-06 08:26:23 -0400 (Thu, 06 Sep 2007)
New Revision: 3469
Added:
trunk/documentation/qa/RHDS-SmokeTestcases.doc
Log:
Added: trunk/documentation/qa/RHDS-SmokeTestcases.doc
===================================================================
(Binary files differ)
Property changes on: trunk/documentation/qa/RHDS-SmokeTestcases.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 8 months
JBoss Tools SVN: r3468 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core: jbosscore/org/jboss/ide/eclipse/as/core/launch and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-06 01:18:47 -0400 (Thu, 06 Sep 2007)
New Revision: 3468
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBIDE-886
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java 2007-09-06 05:18:47 UTC (rev 3468)
@@ -4,11 +4,9 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
-import org.jboss.ide.eclipse.as.core.server.JBossServerBehavior;
import org.jboss.ide.eclipse.as.core.server.stripped.DeployableServerBehavior;
public class DeployableLaunchConfiguration implements
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-06 04:52:37 UTC (rev 3467)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-06 05:18:47 UTC (rev 3468)
@@ -62,7 +62,7 @@
behaviourClass="org.jboss.ide.eclipse.as.core.server.stripped.DeployableServerBehavior"
class="org.jboss.ide.eclipse.as.core.server.stripped.DeployableServer"
description="A server which cannot be started, stopped, or debugged\nbut provides a deploy folder for publishing."
- hasConfiguration="true"
+ hasConfiguration="false"
id="org.jboss.ide.eclipse.as.systemCopyServer"
initialState="stopped"
launchConfigId="org.jboss.ide.eclipse.as.core.server.stripped.launchConfiguration"
16 years, 8 months
JBoss Tools SVN: r3467 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core: META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-06 00:52:37 -0400 (Thu, 06 Sep 2007)
New Revision: 3467
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/AbstractJBossLaunchConfigType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/IJBossServerLaunchDefaults.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/JBossServerStartupLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/StopLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLauncher.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerLaunchDefaults.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/TwiddleLauncher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableLaunchConfiguration.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.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/JBossServerBehavior.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/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
Refactor of launch configurations. Specifically:
Each type (start, stop, twiddle) now have their own launch configuration type, now decoupled.
UI code was simplified immensely
TwiddleDialog and TwiddleLauncher refactored to use new launch type
"Stop" method of ServerBehavior classes modified to use new launches
Fixed classpath bug where users could not modify classpath properly
JBIDE-400
JBIDE-786
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-06 04:52:37 UTC (rev 3467)
@@ -22,6 +22,8 @@
org.apache.ant
Eclipse-LazyStart: true
Export-Package: org.jboss.ide.eclipse.as.core,
+ org.jboss.ide.eclipse.as.core.client,
+ org.jboss.ide.eclipse.as.core.launch,
org.jboss.ide.eclipse.as.core.model,
org.jboss.ide.eclipse.as.core.model.descriptor,
org.jboss.ide.eclipse.as.core.packages,
@@ -33,6 +35,7 @@
org.jboss.ide.eclipse.as.core.server,
org.jboss.ide.eclipse.as.core.server.attributes,
org.jboss.ide.eclipse.as.core.server.stripped,
+ org.jboss.ide.eclipse.as.core.server.xpl,
org.jboss.ide.eclipse.as.core.singledeployable,
org.jboss.ide.eclipse.as.core.util
Bundle-ClassPath: dom4j-1.6.1.jar,
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/AbstractJBossLaunchConfigType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/AbstractJBossLaunchConfigType.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/AbstractJBossLaunchConfigType.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,184 @@
+package org.jboss.ide.eclipse.as.core.launch;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+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.util.ServerConverter;
+
+public abstract class AbstractJBossLaunchConfigType extends AbstractJavaLaunchConfigurationDelegate {
+ protected static final String SERVER_ID = "server-id";
+
+ protected void preLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) {
+ // override me
+ }
+ protected void postLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) {
+ // override me
+ }
+
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ preLaunch(configuration, mode, launch, monitor);
+ actualLaunch(configuration, mode, launch, monitor);
+ postLaunch(configuration, mode, launch, monitor);
+ }
+
+ protected void actualLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ // And off we go!
+ IVMInstall vm = verifyVMInstall(configuration);
+ IVMRunner runner = vm.getVMRunner(mode);
+
+ File workingDir = verifyWorkingDirectory(configuration);
+ String workingDirName = null;
+ if (workingDir != null)
+ workingDirName = workingDir.getAbsolutePath();
+
+ // Program & VM args
+ String pgmArgs = getProgramArguments(configuration);
+ String vmArgs = getVMArguments(configuration);
+ ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
+
+ // VM-specific attributes
+ Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+
+ // Classpath
+ String[] classpath = getClasspath(configuration);
+
+ // Create VM config
+ String mainType = getMainTypeName(configuration);
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainType, classpath);
+ runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+ runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+ runConfig.setWorkingDirectory(workingDirName);
+ runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+
+ // Bootpath
+ String[] bootpath = getBootpath(configuration);
+ if (bootpath != null && bootpath.length > 0)
+ runConfig.setBootClassPath(bootpath);
+
+ setDefaultSourceLocator(launch, configuration);
+
+ // Launch the configuration
+ runner.run(runConfig, launch, monitor);
+ }
+
+
+ protected static JBossServer findJBossServer(String serverId) throws CoreException {
+ if( serverId == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "No server specified"));
+
+ IServer s = ServerCore.findServer(serverId);
+ if( s == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Server Not Found"));
+
+ JBossServer jbs = ServerConverter.getJBossServer(s);
+ if( jbs == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Server Not Found"));
+
+ return jbs;
+ }
+
+ protected static IJBossServerRuntime findJBossServerRuntime(IServer server) throws CoreException {
+ IRuntime rt = server.getRuntime();
+ IJBossServerRuntime jbrt = null;
+ if( rt != null )
+ jbrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ if( jbrt == null )
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Runtime Not Found"));
+ return jbrt;
+ }
+
+ protected static void addCPEntry(ArrayList list, JBossServer jbs, String relative) {
+ list.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(getServerHome(jbs)).append(relative)));
+ }
+
+ protected static ArrayList convertClasspath(ArrayList cp, IVMInstall vmInstall) {
+ if (vmInstall != null) {
+ try {
+ cp.add(JavaRuntime.newRuntimeContainerClasspathEntry(
+ new Path(JavaRuntime.JRE_CONTAINER).append(
+ "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType")
+ .append(vmInstall.getName()),
+ IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
+ } catch (Exception e) {
+ // ignore
+ }
+
+ IPath jrePath = new Path(vmInstall.getInstallLocation()
+ .getAbsolutePath());
+ if (jrePath != null) {
+ IPath toolsPath = jrePath.append("lib").append("tools.jar");
+ if (toolsPath.toFile().exists()) {
+ cp.add(JavaRuntime
+ .newArchiveRuntimeClasspathEntry(toolsPath));
+ }
+ }
+ }
+
+ Iterator cpi = cp.iterator();
+ ArrayList list = new ArrayList();
+ while (cpi.hasNext()) {
+ IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) cpi.next();
+ try {
+ list.add(entry.getMemento());
+ } catch (Exception e) {
+ // Trace.trace(Trace.SEVERE, "Could not resolve classpath entry:
+ // " + entry, e);
+ }
+ }
+
+ return list;
+ }
+
+ protected static void addDirectory(String serverHome, ArrayList classpath,
+ String dirName) {
+ String libPath = serverHome + File.separator + dirName;
+ File libDir = new File(libPath);
+ File libs[] = libDir.listFiles(new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return (name != null && name.endsWith("jar"));
+ }
+ });
+
+ if (libs == null)
+ return;
+
+ for (int i = 0; i < libs.length; i++) {
+ classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(
+ libPath + File.separator + libs[i].getName())));
+ }
+ } // end method
+
+
+ public static String getServerHome(JBossServer jbs) {
+ return jbs.getServer().getRuntime().getLocation().toOSString();
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java (from rev 3446, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableLaunchConfiguration.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/DeployableLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,34 @@
+package org.jboss.ide.eclipse.as.core.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.server.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.stripped.DeployableServerBehavior;
+
+public class DeployableLaunchConfiguration implements
+ ILaunchConfigurationDelegate {
+
+ public static final String ACTION_KEY = "org.jboss.ide.eclipse.as.core.server.stripped.DeployableLaunchConfiguration.Action";
+ public static final String START = "_START_";
+ public static final String STOP = "_STOP_";
+
+ public static DeployableServerBehavior getServerBehavior(ILaunchConfiguration configuration) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ DeployableServerBehavior jbossServerBehavior = (DeployableServerBehavior) server.getAdapter(DeployableServerBehavior.class);
+ return jbossServerBehavior;
+ }
+
+ public void launch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ String action = configuration.getAttribute(ACTION_KEY, START);
+ DeployableServerBehavior behavior = getServerBehavior(configuration);
+ if( START.equals(action)) behavior.setServerStarted();
+ if( STOP.equals(action)) behavior.setServerStopped();
+ }
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/IJBossServerLaunchDefaults.java (from rev 3446, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerLaunchDefaults.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/IJBossServerLaunchDefaults.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/IJBossServerLaunchDefaults.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,45 @@
+/*
+ * 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.core.launch;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+/**
+ * Setting launch defaults. Each server can have it's own implementation
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public interface IJBossServerLaunchDefaults {
+ public String getStartArgs();
+ public String getStopArgs();
+ public String getVMArgs();
+ public List getRuntimeClasspath(String action);
+ public String getStartJar();
+ public String getShutdownJar();
+ public String getStartMainType();
+ public String getStopMainType();
+
+ public void fillDefaults(ILaunchConfigurationWorkingCopy wc) throws CoreException;
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/JBossServerStartupLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/JBossServerStartupLaunchConfiguration.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/JBossServerStartupLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,167 @@
+/**
+ * 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.launch;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.ServerType;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+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.JBossServerBehavior;
+
+public class JBossServerStartupLaunchConfiguration extends AbstractJBossLaunchConfigType {
+
+ protected static final char[] INVALID_CHARS = new char[] {'\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0', '@', '&'};
+
+ private static final String LAUNCH_TYPE = "org.jboss.ide.eclipse.as.core.server.startupConfiguration";
+ private static final String DEFAULTS_SET = "jboss.defaults.been.set";
+ private static final String START_JAR_LOC = "bin" + Path.SEPARATOR + "run.jar";
+ private static final String START_MAIN_TYPE = "org.jboss.Main";
+
+
+ public static ILaunchConfigurationWorkingCopy setupLaunchConfiguration(IServer server, String action) throws CoreException {
+ ILaunchConfigurationWorkingCopy config = createLaunchConfiguration(server);
+ setupLaunchConfiguration(config, server);
+ return config;
+ }
+
+ public static void setupLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy workingCopy, IServer server) throws CoreException {
+ ensureDefaultsSet(workingCopy, server);
+ }
+
+ public static void ensureDefaultsSet(ILaunchConfigurationWorkingCopy wc, IServer server) throws CoreException {
+ if( wc.getAttribute(DEFAULTS_SET, (String)null ) == null ) {
+ JBossServer jbs = findJBossServer(server.getId());
+ IJBossServerRuntime jbrt = findJBossServerRuntime(server);
+ String serverHome = getServerHome(jbs);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(LAUNCH_TYPE);
+
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getDefaultArgs(jbs));
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, START_MAIN_TYPE);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, serverHome + Path.SEPARATOR + "bin");
+ ArrayList classpath = new ArrayList();
+ addCPEntry(classpath, jbs, START_JAR_LOC);
+ ArrayList runtimeClassPaths = convertClasspath(classpath, jbrt.getVM());
+ String cpKey = IJavaLaunchConfigurationConstants.ATTR_CLASSPATH;
+ wc.setAttribute(cpKey, runtimeClassPaths);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ wc.setAttribute(DEFAULTS_SET, true);
+ }
+ }
+
+ public static String getDefaultArgs(JBossServer jbs) throws CoreException {
+ IJBossServerRuntime rt = findJBossServerRuntime(jbs.getServer());
+ if (rt != null) {
+ return "--configuration=" + rt.getJBossConfiguration();
+ }
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Runtime not found"));
+ }
+
+
+ public void postLaunch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) {
+ try {
+ IProcess[] processes = launch.getProcesses();
+ JBossServerBehavior jbsBehavior = getServerBehavior(configuration);
+ jbsBehavior.setProcess(processes[0]);
+ jbsBehavior.serverStarting();
+ } catch( CoreException ce ) {
+ // report
+ }
+ }
+
+ public static JBossServerBehavior getServerBehavior(ILaunchConfiguration configuration) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ JBossServerBehavior jbossServerBehavior = (JBossServerBehavior) server.getAdapter(JBossServerBehavior.class);
+ return jbossServerBehavior;
+ }
+
+ protected static String getValidLaunchConfigurationName(String s) {
+ if (s == null || s.length() == 0)
+ return "1";
+ int size = INVALID_CHARS.length;
+ for (int i = 0; i < size; i++) {
+ s = s.replace(INVALID_CHARS[i], '_');
+ }
+ return s;
+ }
+
+ /**
+ * Will create a launch configuration for the server
+ * if one does not already exist.
+ */
+ public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server) throws CoreException {
+ ILaunchConfigurationType launchConfigType =
+ ((ServerType) server.getServerType()).getLaunchConfigurationType();
+ if (launchConfigType == null)
+ return null;
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfiguration[] launchConfigs = null;
+ try {
+ launchConfigs = launchManager.getLaunchConfigurations(launchConfigType);
+ } catch (CoreException e) {
+ // ignore
+ }
+
+ if (launchConfigs != null) {
+ int size = launchConfigs.length;
+ for (int i = 0; i < size; i++) {
+ try {
+ String serverId = launchConfigs[i].getAttribute(SERVER_ID, (String) null);
+ if (server.getId().equals(serverId)) {
+ ILaunchConfigurationWorkingCopy wc = launchConfigs[i].getWorkingCopy();
+ return wc;
+ }
+ } catch (CoreException e) {
+ }
+ }
+ }
+
+ // create a new launch configuration
+ String launchName = getValidLaunchConfigurationName(server.getName());
+ launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName);
+ ILaunchConfigurationWorkingCopy wc = launchConfigType.newInstance(null, launchName);
+ wc.setAttribute(SERVER_ID, server.getId());
+ return wc;
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java (from rev 3446, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,302 @@
+/**
+ * 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.launch;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+
+/**
+ * A class of launch defaults including how to start, stop, and twiddle a
+ * server.
+ *
+ * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
+ *
+ */
+public class ServerLaunchDefaults implements IJBossServerLaunchDefaults {
+
+ @Override
+ public void fillDefaults(ILaunchConfigurationWorkingCopy wc)
+ throws CoreException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List getRuntimeClasspath(String action) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getShutdownJar() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getStartArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getStartJar() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getStartMainType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getStopArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getStopMainType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getVMArgs() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+// /*
+// * Can be overwritten by subclasses
+// */
+// protected String startMainType = "org.jboss.Main";
+// protected String defaultShutdownArgs = "-S";
+// protected String runJar = "bin" + File.separator + "run.jar";
+// protected IServer server;
+// protected IJBossServerRuntime runtime;
+// protected JBossServer jbServer;
+//
+// public ServerLaunchDefaults(IServer server) {
+// this.server = server;
+// }
+//
+// protected JBossServer getJBServer() {
+// if (jbServer == null) {
+// try {
+// jbServer = (JBossServer) server.loadAdapter(JBossServer.class,
+// new NullProgressMonitor());
+// } catch (Exception e) {
+// }
+// }
+// return jbServer;
+// }
+//
+// protected IJBossServerRuntime getRuntime() {
+// if (runtime == null) {
+// try {
+// runtime = (IJBossServerRuntime) server.getRuntime()
+// .loadAdapter(IJBossServerRuntime.class,
+// new NullProgressMonitor());
+// } catch (Exception e) {
+// }
+// }
+// return runtime;
+// }
+//
+// public void fillDefaults(ILaunchConfigurationWorkingCopy workingCopy)
+// throws CoreException {
+// IJBossServerRuntime runtime = getRuntime();
+// String argsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS;
+// String vmArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS;
+//
+// String START_SUFFIX = JBossServerStartupLaunchConfiguration.PRGM_ARGS_START_SUFFIX;
+// String STOP_SUFFIX = JBossServerStartupLaunchConfiguration.PRGM_ARGS_STOP_SUFFIX;
+//
+// // START items
+// workingCopy.setAttribute(argsKey + START_SUFFIX, getStartArgs());
+// workingCopy.setAttribute(vmArgsKey + START_SUFFIX, getVMArgs());
+//
+// // STOP items
+// workingCopy.setAttribute(argsKey + STOP_SUFFIX, getStopArgs());
+// workingCopy.setAttribute(vmArgsKey + STOP_SUFFIX, getVMArgs());
+//
+// /* Now add in the main types */
+// String mainKey = IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME;
+// workingCopy.setAttribute(mainKey + START_SUFFIX, getStartMainType());
+// workingCopy.setAttribute(mainKey + STOP_SUFFIX, getStopMainType());
+//
+// String wdKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY;
+// String wdVal = getServerHome() + Path.SEPARATOR + "bin";
+// workingCopy.setAttribute(wdKey + START_SUFFIX, wdVal);
+// workingCopy.setAttribute(wdKey + STOP_SUFFIX, wdVal);
+//
+// workingCopy
+// .setAttribute(
+// IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
+// false);
+// String cpKey = IJavaLaunchConfigurationConstants.ATTR_CLASSPATH;
+// workingCopy.setAttribute(cpKey + START_SUFFIX,
+// getRuntimeClasspath(JBossServerStartupLaunchConfiguration.START));
+// workingCopy.setAttribute(cpKey + STOP_SUFFIX,
+// getRuntimeClasspath(JBossServerStartupLaunchConfiguration.STOP));
+// }
+//
+// public String getStartArgs() {
+// IJBossServerRuntime rt = getRuntime();
+// if (rt != null) {
+// return "--configuration=" + rt.getJBossConfiguration();
+// }
+// return "";
+// }
+//
+// public String getServerHome() {
+// return server.getRuntime().getLocation().toOSString();
+// }
+//
+// public String getConfigurationPath() {
+// try {
+// return getServerHome() + Path.SEPARATOR + "server" + Path.SEPARATOR
+// + getRuntime().getJBossConfiguration();
+// } catch (Exception e) {
+// }
+// return "";
+// }
+//
+// public String getStartJar() {
+// return getServerHome() + Path.SEPARATOR + runJar;
+// }
+//
+// public String getShutdownJar() {
+// return getServerHome() + Path.SEPARATOR + shutdownJar;
+// }
+//
+// public String getStartMainType() {
+// return startMainType;
+// }
+//
+// public String getStopMainType() {
+// return stopMainType;
+// }
+//
+// public String getStopArgs() {
+// return defaultShutdownArgs;
+// }
+//
+// public String getVMArgs() {
+// return defaultVMArgs;
+// }
+//
+// public List getRuntimeClasspath(String action) {
+// String serverHome = getServerHome();
+// ArrayList classpath = new ArrayList();
+//
+// if (action.equals(JBossServerStartupLaunchConfiguration.START)) {
+// classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(
+// getStartJar())));
+// } else if (action.equals(JBossServerStartupLaunchConfiguration.STOP)) {
+// classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(
+// getShutdownJar())));
+// }
+// ArrayList runtimeClassPaths = convertClasspath(classpath, runtime
+// .getVM());
+// return runtimeClassPaths;
+// }
+//
+// private ArrayList convertClasspath(ArrayList cp, IVMInstall vmInstall) {
+// if (vmInstall != null) {
+// try {
+// cp
+// .add(JavaRuntime
+// .newRuntimeContainerClasspathEntry(
+// new Path(JavaRuntime.JRE_CONTAINER)
+// .append(
+// "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType")
+// .append(vmInstall.getName()),
+// IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
+// } catch (Exception e) {
+// // ignore
+// }
+//
+// IPath jrePath = new Path(vmInstall.getInstallLocation()
+// .getAbsolutePath());
+// if (jrePath != null) {
+// IPath toolsPath = jrePath.append("lib").append("tools.jar");
+// if (toolsPath.toFile().exists()) {
+// cp.add(JavaRuntime
+// .newArchiveRuntimeClasspathEntry(toolsPath));
+// }
+// }
+// }
+//
+// Iterator cpi = cp.iterator();
+// ArrayList list = new ArrayList();
+// while (cpi.hasNext()) {
+// IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) cpi.next();
+// try {
+// list.add(entry.getMemento());
+// } catch (Exception e) {
+// // Trace.trace(Trace.SEVERE, "Could not resolve classpath entry:
+// // " + entry, e);
+// }
+// }
+//
+// return list;
+// }
+//
+// private void addDirectory(String serverHome, ArrayList classpath,
+// String dirName) {
+// String libPath = serverHome + File.separator + dirName;
+// File libDir = new File(libPath);
+// File libs[] = libDir.listFiles(new FilenameFilter() {
+// public boolean accept(File dir, String name) {
+// return (name != null && name.endsWith("jar"));
+// }
+// });
+//
+// if (libs == null)
+// return;
+//
+// for (int i = 0; i < libs.length; i++) {
+// classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(
+// libPath + File.separator + libs[i].getName())));
+// }
+// } // end method
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/StopLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/StopLaunchConfiguration.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/StopLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,76 @@
+package org.jboss.ide.eclipse.as.core.launch;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+
+
+public class StopLaunchConfiguration extends AbstractJBossLaunchConfigType {
+
+ public static final String STOP_LAUNCH_TYPE = "org.jboss.ide.eclipse.as.core.server.stopLaunchConfiguration";
+ public static final String STOP_MAIN_TYPE = "org.jboss.Shutdown";
+ public static final String STOP_JAR_LOC = "bin" + File.separator + "shutdown.jar";
+
+ public static void stop(IServer server) {
+ try {
+ ILaunchConfigurationWorkingCopy wc = createLaunchConfiguration(server);
+ wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
+ } catch( CoreException ce ) {
+ // report it from here
+ }
+ }
+
+ protected void preLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) {
+ }
+
+
+ public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server) throws CoreException {
+ JBossServer jbs = findJBossServer(server.getId());
+ IJBossServerRuntime jbrt = findJBossServerRuntime(server);
+ String serverHome = getServerHome(jbs);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(STOP_LAUNCH_TYPE);
+
+ String launchName = TwiddleLaunchConfiguration.class.getName();
+ launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName);
+ ILaunchConfigurationWorkingCopy wc = launchConfigType.newInstance(null, launchName);
+ wc.setAttribute(SERVER_ID, server.getId());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getDefaultArgs(jbs));
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, STOP_MAIN_TYPE);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, serverHome + Path.SEPARATOR + "bin");
+ ArrayList classpath = new ArrayList();
+ addCPEntry(classpath, jbs, STOP_JAR_LOC);
+ ArrayList runtimeClassPaths = convertClasspath(classpath, jbrt.getVM());
+ String cpKey = IJavaLaunchConfigurationConstants.ATTR_CLASSPATH;
+ wc.setAttribute(cpKey, runtimeClassPaths);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+
+ return wc;
+ }
+
+ public static String getDefaultArgs(JBossServer jbs) throws CoreException {
+ String args = "-S ";
+ if( jbs.getUsername() != null )
+ args += "-u " + jbs.getUsername() + " ";
+ if( jbs.getPassword() != null )
+ args += "-p " + jbs.getPassword() + " ";
+ return args;
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLaunchConfiguration.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,68 @@
+package org.jboss.ide.eclipse.as.core.launch;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.JBossServer;
+
+public class TwiddleLaunchConfiguration extends AbstractJBossLaunchConfigType {
+
+ public static final String TWIDDLE_LAUNCH_TYPE = "org.jboss.ide.eclipse.as.core.server.twiddleConfiguration";
+
+ protected static final String TWIDDLE_MAIN_TYPE = "org.jboss.console.twiddle.Twiddle";
+ protected static final String TWIDDLE_JAR_LOC = "bin" + File.separator + "twiddle.jar";
+
+ public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server) throws CoreException {
+ return createLaunchConfiguration(server, getDefaultArgs(server));
+ }
+
+ public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server, String args) throws CoreException {
+ JBossServer jbs = findJBossServer(server.getId());
+ IJBossServerRuntime jbrt = findJBossServerRuntime(server);
+ String serverHome = getServerHome(jbs);
+
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigType = launchManager.getLaunchConfigurationType(TWIDDLE_LAUNCH_TYPE);
+
+ String launchName = TwiddleLaunchConfiguration.class.getName();
+ launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName);
+ ILaunchConfigurationWorkingCopy wc = launchConfigType.newInstance(null, launchName);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, TWIDDLE_MAIN_TYPE);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, serverHome + Path.SEPARATOR + "bin");
+
+ ArrayList classpath = new ArrayList();
+ addCPEntry(classpath, jbs, TWIDDLE_JAR_LOC);
+ // Twiddle requires more classes and I'm too lazy to actually figure OUT which ones it needs.
+ addDirectory (serverHome, classpath, "lib");
+ addDirectory (serverHome, classpath, "lib" + File.separator + "endorsed");
+ addDirectory (serverHome, classpath, "client");
+ ArrayList runtimeClassPaths = convertClasspath(classpath, jbrt.getVM());
+ String cpKey = IJavaLaunchConfigurationConstants.ATTR_CLASSPATH;
+ wc.setAttribute(cpKey, runtimeClassPaths);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+
+ return wc;
+ }
+
+ public static String getDefaultArgs(IServer server) throws CoreException {
+ JBossServer jbs = findJBossServer(server.getId());
+ String twiddleArgs = "-s " + jbs.getServer().getHost() + ":"
+ + jbs.getJNDIPort() + " -a jmx/rmi/RMIAdaptor ";
+ if( jbs.getUsername() != null )
+ twiddleArgs += "-u " + jbs.getUsername() + " ";
+ if( jbs.getPassword() != null )
+ twiddleArgs += "-p " + jbs.getPassword() + " ";
+ return twiddleArgs;
+ }
+
+}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLauncher.java (from rev 3446, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/TwiddleLauncher.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLauncher.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/TwiddleLauncher.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -0,0 +1,210 @@
+/**
+ * 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.launch;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.IStreamListener;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.wst.server.core.IServer;
+
+public class TwiddleLauncher {
+
+ /**
+ * Create one launch for each String of arguments.
+ * Each element in the array is a COMPLETE LIST of arguments.
+ * For example:
+ * twiddleArgs[0] = "-s localhost:1099 -a jmx/rmi/RMIAdaptor get \"whatever\""
+ * twiddleArgs[1] = "-s localhost:1099 -a jmx/rmi/RMIAdaptor get \"whatever2\""
+ *
+ * @param twiddleArgs
+ * @param jbServer
+ * @param seed
+ * @return
+ */
+ public static ProcessData[] launchTwiddles(String[] twiddleArgs, IServer server, boolean addPrefix) throws CoreException {
+ ILaunchConfigurationWorkingCopy wc;
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < twiddleArgs.length; i++ ) {
+ String args2 = addPrefix ? TwiddleLaunchConfiguration.getDefaultArgs(server) + twiddleArgs[i] : twiddleArgs[i];
+ wc = TwiddleLaunchConfiguration.createLaunchConfiguration(server, args2);
+ ILaunch launch = wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor(), false, false);
+ list.addAll(Arrays.asList(toProcessDatas(launch.getProcesses())));
+ }
+
+ ProcessData[] ret = new ProcessData[list.size()];
+ list.toArray(ret);
+
+ return ret;
+ }
+
+ protected static ProcessData[] toProcessDatas(IProcess[] processes) {
+ ProcessData[] datas = new ProcessData[processes.length];
+ for( int i = 0; i < processes.length; i++ ) {
+ datas[i] = new ProcessData(processes[i], "");
+ datas[i].startListening();
+ }
+ return datas;
+ }
+
+ private boolean canceled = false;
+ private int delay = 500;
+
+ public void setCanceled() {
+ canceled = true;
+ }
+
+ public ProcessData[] getTwiddleResults(IServer server, String args, boolean addPrefix ) {
+ ProcessData[] processes;
+ try {
+ processes = TwiddleLauncher.launchTwiddles(new String[] { args }, server, addPrefix);
+ } catch( CoreException ce ) {
+ return new ProcessData[0];
+ }
+ waitForThreadsToTerminate(processes);
+
+ // stop listening
+ for( int i = 0; i < processes.length; i++ ) {
+ processes[i].stopListening();
+ if( canceled ) {
+ try {
+ // if canceled, terminate all twiddle processes
+ processes[i].getProcess().terminate();
+ } catch( Exception e ) {}
+ }
+ }
+
+ return processes;
+ }
+
+ protected void waitForThreadsToTerminate(ProcessData[] processes) {
+ boolean allTerminated = false;
+ while( !allTerminated && !canceled) {
+ allTerminated = true;
+ for( int i = 0; i < processes.length; i++ ) {
+ if( processes[i].getProcess().isTerminated() == false ) {
+ allTerminated = false;
+ }
+ }
+ if( !allTerminated ) {
+ // sleep
+ try {
+ Thread.sleep(delay);
+ } catch( InterruptedException ie ) {
+ }
+ }
+ }
+ }
+
+ public static class ProcessData implements IStreamListener {
+ private String args;
+ private String processType;
+
+ private IProcess process;
+ private IStreamMonitor outMonitor;
+ private IStreamMonitor errMonitor;
+
+ private String out, err;
+
+ public ProcessData(IProcess process, String processType) {
+ this(null, process, processType);
+ try {
+ this.args = process.getLaunch().getLaunchConfiguration().
+ getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null);
+ } catch( CoreException ce ) {
+ }
+
+ }
+
+ public ProcessData(String args, IProcess process, String processType) {
+ this.args = args;
+ this.process = process;
+ this.processType = processType;
+
+ //ASDebug.p("process is " + process, this);
+ //ASDebug.p("Stream Proxy is " + process.getStreamsProxy(), this);
+ this.outMonitor = process.getStreamsProxy().getOutputStreamMonitor();
+ this.errMonitor = process.getStreamsProxy().getErrorStreamMonitor();
+
+ out = "";
+ err = "";
+ }
+
+ public void startListening() {
+ outMonitor.addListener(this);
+ errMonitor.addListener(this);
+ }
+
+ public void stopListening() {
+ outMonitor.removeListener(this);
+ errMonitor.removeListener(this);
+ }
+
+ public void resetStrings() {
+ out = "";
+ err = "";
+ }
+
+ public void destroy() {
+ stopListening();
+ resetStrings();
+ }
+
+ public void streamAppended(String text, IStreamMonitor monitor) {
+ if( monitor == outMonitor ) {
+ out += text;
+ } else if( monitor == errMonitor ) {
+ err += text;
+ }
+ }
+
+ public String getArgs() {
+ return args;
+ }
+
+ public String getErr() {
+ return err;
+ }
+
+ public String getOut() {
+ return out;
+ }
+
+ public String getProcesType() {
+ return processType;
+ }
+
+ public IProcess getProcess() {
+ return process;
+ }
+
+ }
+
+}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerLaunchDefaults.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerLaunchDefaults.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerLaunchDefaults.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -1,48 +0,0 @@
-/*
- * 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.core.runtime;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-
-/**
- * Setting launch defaults. Each server can have it's own implementation
- * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
- *
- */
-public interface IJBossServerLaunchDefaults {
- public String getStartArgs();
- public String getStopArgs();
- public String getVMArgs();
- public List getRuntimeClasspath(String action);
- public String getStartJar();
- public String getShutdownJar();
- public String getTwiddleJar();
- public String getStartMainType();
- public String getStopMainType();
- public String getTwiddleMainType();
-
-
- public void fillDefaults(ILaunchConfigurationWorkingCopy wc) throws CoreException;
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/ServerLaunchDefaults.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -1,276 +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 java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerLaunchDefaults;
-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.JBossServerLaunchConfiguration;
-
-/**
- * A class of launch defaults including how to start, stop, and twiddle
- * a server.
- * @author <a href="rob.stryker(a)redhat.com">Rob Stryker</a>
- *
- */
-public class ServerLaunchDefaults implements IJBossServerLaunchDefaults {
-
- /*
- * Can be overwritten by subclasses
- */
- protected String startMainType = "org.jboss.Main";
- protected String stopMainType = "org.jboss.Shutdown";
- protected String twiddleMainType = "org.jboss.console.twiddle.Twiddle";
-
- protected String defaultShutdownArgs = "-S";
- protected String defaultVMArgs = "";
-
- protected String runJar = "bin" + File.separator + "run.jar";
- protected String shutdownJar = "bin" + File.separator + "shutdown.jar";
- protected String twiddleJar = "bin" + File.separator + "twiddle.jar";
-
-
-
- protected IServer server;
- protected IJBossServerRuntime runtime;
- protected JBossServer jbServer;
-
- public ServerLaunchDefaults(IServer server) {
- this.server = server;
- }
-
- protected JBossServer getJBServer() {
- if( jbServer == null ) {
- try {
- jbServer = (JBossServer)server.loadAdapter(JBossServer.class, new NullProgressMonitor());
- } catch( Exception e) {
- }
- }
- return jbServer;
- }
- protected IJBossServerRuntime getRuntime() {
- if( runtime == null ) {
- try {
- runtime = (IJBossServerRuntime) server.getRuntime()
- .loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- } catch( Exception e ) {
- }
- }
- return runtime;
- }
-
- public void fillDefaults(ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
- IJBossServerRuntime runtime = getRuntime();
- String argsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS;
- String vmArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS;
-
- String START_SUFFIX = JBossServerLaunchConfiguration.PRGM_ARGS_START_SUFFIX;
- String STOP_SUFFIX = JBossServerLaunchConfiguration.PRGM_ARGS_STOP_SUFFIX;
- String TWIDDLE_SUFFIX = JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX;
-
-
-
- // START items
- workingCopy.setAttribute(argsKey + START_SUFFIX, getStartArgs());
- workingCopy.setAttribute(vmArgsKey + START_SUFFIX, getVMArgs());
-
- // STOP items
- workingCopy.setAttribute(argsKey + STOP_SUFFIX, getStopArgs());
- workingCopy.setAttribute(vmArgsKey + STOP_SUFFIX, getVMArgs());
-
-
- int jndiPort = getJBServer().getJNDIPort();
- String host = server.getHost();
- String twiddleArgs = "-s " + host + ":" + jndiPort + " -a jmx/rmi/RMIAdaptor ";
-
- workingCopy.setAttribute(argsKey + TWIDDLE_SUFFIX, twiddleArgs);
- workingCopy.setAttribute(vmArgsKey + TWIDDLE_SUFFIX, "");
-
-
-
- /* Now add in the main types */
- String mainKey = IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME;
- workingCopy.setAttribute(mainKey + START_SUFFIX, getStartMainType());
- workingCopy.setAttribute(mainKey + STOP_SUFFIX, getStopMainType());
- workingCopy.setAttribute(mainKey + TWIDDLE_SUFFIX, twiddleMainType);
-
- String wdKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY;
- String wdVal = getServerHome() + Path.SEPARATOR + "bin";
- workingCopy.setAttribute( wdKey + START_SUFFIX, wdVal);
- workingCopy.setAttribute( wdKey + STOP_SUFFIX, wdVal);
- workingCopy.setAttribute( wdKey + TWIDDLE_SUFFIX, wdVal);
-
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
- String cpKey = IJavaLaunchConfigurationConstants.ATTR_CLASSPATH;
- workingCopy.setAttribute(cpKey + START_SUFFIX, getRuntimeClasspath(JBossServerLaunchConfiguration.START));
- workingCopy.setAttribute(cpKey + STOP_SUFFIX, getRuntimeClasspath(JBossServerLaunchConfiguration.STOP));
- workingCopy.setAttribute(cpKey + TWIDDLE_SUFFIX, getRuntimeClasspath(JBossServerLaunchConfiguration.TWIDDLE));
- }
-
-
- public String getStartArgs() {
- IJBossServerRuntime rt = getRuntime();
- if( rt != null ) {
- return "--configuration=" + rt.getJBossConfiguration();
- }
- return "";
- }
-
-
- public String getServerHome() {
- return server.getRuntime().getLocation().toOSString();
- }
-
- public String getConfigurationPath() {
- try {
- return getServerHome() + Path.SEPARATOR + "server" + Path.SEPARATOR + getRuntime().getJBossConfiguration();
- } catch( Exception e ) {
- }
- return "";
- }
-
- public String getStartJar() {
- return getServerHome() + Path.SEPARATOR + runJar;
- }
-
- public String getShutdownJar() {
- return getServerHome() + Path.SEPARATOR + shutdownJar;
- }
-
- public String getTwiddleJar() {
- return getServerHome() + Path.SEPARATOR + twiddleJar;
- }
-
- public String getStartMainType() {
- return startMainType;
- }
-
- public String getStopMainType() {
- return stopMainType;
- }
-
- public String getTwiddleMainType() {
- return twiddleMainType;
- }
-
- public String getStopArgs() {
- return defaultShutdownArgs;
- }
-
- public String getVMArgs() {
- return defaultVMArgs;
- }
-
-
- public List getRuntimeClasspath(String action) {
- String serverHome = getServerHome();
- ArrayList classpath = new ArrayList();
-
- if( action.equals(JBossServerLaunchConfiguration.START)) {
- classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(getStartJar())));
- } else if( action.equals(JBossServerLaunchConfiguration.STOP)) {
- classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(getShutdownJar())));
- } else if( action.equals(JBossServerLaunchConfiguration.TWIDDLE)) {
-
- // Twiddle requires more classes and I'm too lazy to actually figure OUT which ones it needs.
- classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(getTwiddleJar())));
- addDirectory (serverHome, classpath, "lib");
- addDirectory (serverHome, classpath, "lib" + File.separator + "endorsed");
- addDirectory (serverHome, classpath, "client");
- addDirectory (getConfigurationPath(), classpath, "lib");
- }
-
- ArrayList runtimeClassPaths = convertClasspath(classpath, runtime.getVM());
- return runtimeClassPaths;
- }
-
- private ArrayList convertClasspath(ArrayList cp, IVMInstall vmInstall) {
- if (vmInstall != null) {
- try {
- cp.add(JavaRuntime.newRuntimeContainerClasspathEntry(
- new Path(JavaRuntime.JRE_CONTAINER)
- .append("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType")
- .append(vmInstall.getName()), IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
- } catch (Exception e) {
- // ignore
- }
-
- IPath jrePath = new Path(vmInstall.getInstallLocation().getAbsolutePath());
- if (jrePath != null) {
- IPath toolsPath = jrePath.append("lib").append("tools.jar");
- if (toolsPath.toFile().exists()) {
- cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(toolsPath));
- }
- }
- }
-
- Iterator cpi = cp.iterator();
- ArrayList list = new ArrayList();
- while (cpi.hasNext()) {
- IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry) cpi.next();
- try {
- list.add(entry.getMemento());
- } catch (Exception e) {
- //Trace.trace(Trace.SEVERE, "Could not resolve classpath entry: " + entry, e);
- }
- }
-
- return list;
- }
-
- private void addDirectory (String serverHome, ArrayList classpath, String dirName) {
- String libPath = serverHome + File.separator + dirName;
- File libDir = new File(libPath);
- File libs[] = libDir.listFiles(new FilenameFilter(){
- public boolean accept(File dir, String name)
- {
- return (name != null && name.endsWith("jar"));
- }
- });
-
- if( libs == null ) return;
-
- for (int i = 0; i < libs.length; i++)
- {
- classpath.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(libPath + File.separator + libs[i].getName())));
- }
- } // end method
-
-
-
-}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -47,12 +47,9 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration;
-import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
@@ -164,23 +161,12 @@
try {
ILaunchConfiguration lc = server.getLaunchConfiguration(true,
new NullProgressMonitor());
- String twiddleArgs = lc
- .getAttribute(
- IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
- + JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX,
- (String) null);
-
// get user from the IServer, but override with launch configuration
String user = ServerConverter.getJBossServer(server).getUsername();
- String userLaunch = ArgsUtil.getValue(twiddleArgs, "-u", "--user");
- user = userLaunch == null ? user : userLaunch;
// get password from the IServer, but override with launch configuration
String pass = ServerConverter.getJBossServer(server).getPassword();
- String passwordLaunch = ArgsUtil.getValue(twiddleArgs, "-p", "--password");
- pass = passwordLaunch == null ? pass : passwordLaunch;
-
// get our methods
Class simplePrincipal = Thread.currentThread()
.getContextClassLoader().loadClass(
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-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServer.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -44,11 +44,12 @@
import org.eclipse.wst.server.core.model.IURLProvider;
import org.eclipse.wst.server.core.model.ServerDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.launch.IJBossServerLaunchDefaults;
+import org.jboss.ide.eclipse.as.core.launch.JBossServerStartupLaunchConfiguration;
+import org.jboss.ide.eclipse.as.core.launch.ServerLaunchDefaults;
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.runtime.IJBossServerLaunchDefaults;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.runtime.server.ServerLaunchDefaults;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.attributes.IServerStartupParameters;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
@@ -76,11 +77,6 @@
public void configurationChanged() {
}
-
- public IJBossServerLaunchDefaults getLaunchDefaults() {
- return new ServerLaunchDefaults(getServer());
- }
-
/*
* Abstracts to implement
@@ -153,8 +149,10 @@
try {
Server s = (Server)getServer();
ILaunchConfiguration lc = s.getLaunchConfiguration(true, new NullProgressMonitor());
- String startArgs = lc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
- + JBossServerLaunchConfiguration.PRGM_ARGS_START_SUFFIX, (String)null);
+ // TODO FIX
+// String startArgs = lc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
+// + JBossServerStartupLaunchConfiguration.PRGM_ARGS_START_SUFFIX, (String)null);
+ String startArgs = "";
Map map = ArgsUtil.getSystemProperties(startArgs);
if( map.get(JBOSS_SERVER_HOME_DIR) != null )
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerBehavior.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -23,20 +23,18 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.launch.JBossServerStartupLaunchConfiguration;
+import org.jboss.ide.eclipse.as.core.launch.StopLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.model.EventLogModel;
import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.runtime.server.polling.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.runtime.server.polling.PollThread;
-import org.jboss.ide.eclipse.as.core.runtime.server.polling.JMXPoller;
import org.jboss.ide.eclipse.as.core.server.stripped.DeployableServerBehavior;
public class JBossServerBehavior extends DeployableServerBehavior {
@@ -61,18 +59,10 @@
return;
}
- Thread t = new Thread() {
- public void run() {
- // Otherwise execute a shutdown attempt
- try {
- // Set up our launch configuration for a STOP call (to shutdown.jar)
- ILaunchConfiguration wc = JBossServerLaunchConfiguration.setupLaunchConfiguration(getServer(), JBossServerLaunchConfiguration.STOP);
- wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
- } catch( Exception e ) {
- }
- }
- };
- t.start();
+ new Thread() {public void run() {
+ serverStopping();
+ StopLaunchConfiguration.stop(getServer());
+ }}.start();
}
public void forceStop() {
@@ -105,7 +95,7 @@
}
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
- JBossServerLaunchConfiguration.setupLaunchConfiguration(workingCopy, getServer(), JBossServerLaunchConfiguration.START);
+ JBossServerStartupLaunchConfiguration.setupLaunchConfiguration(workingCopy, getServer());
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/JBossServerLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -1,305 +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.server;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-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.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate;
-import org.eclipse.jdt.launching.ExecutionArguments;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.IVMRunner;
-import org.eclipse.jdt.launching.VMRunnerConfiguration;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
-
-public class JBossServerLaunchConfiguration extends AbstractJavaLaunchConfigurationDelegate {
-
- public static final String START = "_START_";
- public static final String STOP = "_STOP_";
- public static final String TWIDDLE = "_TWIDDLE_";
-
- public static final String CURRENT_ACTION = "org.jboss.ide.eclipse.as.core.server.currentAction";
- public static final String DEFAULT_SETTINGS = "org.jboss.ide.eclipse.as.core.server.defaultsSet";
-
-
- protected static final char[] INVALID_CHARS = new char[] {'\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0', '@', '&'};
- public static final String PRGM_ARGS_START_SUFFIX = "org.jboss.ide.eclipse.as.core.server.start_suffix";
- public static final String PRGM_ARGS_STOP_SUFFIX = "org.jboss.ide.eclipse.as.core.server.stop_suffix";
- public static final String PRGM_ARGS_TWIDDLE_SUFFIX = "org.jboss.ide.eclipse.as.core.server.twiddle_suffix";
-
-
-
- public static JBossServerBehavior getServerBehavior(ILaunchConfiguration configuration) throws CoreException {
- IServer server = ServerUtil.getServer(configuration);
- JBossServerBehavior jbossServerBehavior = (JBossServerBehavior) server.getAdapter(JBossServerBehavior.class);
- return jbossServerBehavior;
- }
-
- public static JBossServer getJBossServer(ILaunchConfiguration configuration) throws CoreException {
- // Get access to some important structures
- return getJBossServer(ServerUtil.getServer(configuration));
- }
-
- public static JBossServer getJBossServer(IServer server) {
- if( server == null ) return null;
- JBossServer jbServer = (JBossServer)server.getAdapter(JBossServer.class);
- if (jbServer == null) {
- jbServer = (JBossServer) server.loadAdapter(JBossServer.class, new NullProgressMonitor());
- }
- return jbServer;
- }
-
-
- public static ILaunchConfigurationWorkingCopy setupLaunchConfiguration(IServer server, String action) throws CoreException {
- ILaunchConfigurationWorkingCopy config = createLaunchConfiguration(server);
- setupLaunchConfiguration(config, server, action);
- return config;
- }
-
- public static void ensureDefaultsSet(ILaunchConfigurationWorkingCopy workingCopy, IServer server ) {
- if( !defaultsBeenSet(workingCopy, server) ) {
- try {
- getJBossServer(server).getLaunchDefaults().fillDefaults(workingCopy);
- workingCopy.setAttribute(DEFAULT_SETTINGS, true);
- } catch( CoreException ce ) {}
- }
- }
-
- public static void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
- IServer server, String action) throws CoreException {
-
- ensureDefaultsSet(workingCopy, server);
-
- // Now that defaults have all been set, set it up for the action (start, stop, twiddle etc)
- String argsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS;
- String vmArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS;
- workingCopy.setAttribute(CURRENT_ACTION, action);
-
- String suffix;
- if( START.equals(action)) {
- suffix = PRGM_ARGS_START_SUFFIX;
- } else if( STOP.equals(action)) {
- suffix = PRGM_ARGS_STOP_SUFFIX;
- } else if( TWIDDLE.equals(action)) {
- suffix = PRGM_ARGS_TWIDDLE_SUFFIX;
- } else {
- throw new CoreException(null);
- }
-
- try {
- String pgArgs = workingCopy.getAttribute(argsKey + suffix, (String)null);
- workingCopy.setAttribute(argsKey,pgArgs);
-
-
- String vmArgs = workingCopy.getAttribute(vmArgsKey + suffix, (String)null);
- workingCopy.setAttribute(vmArgsKey, vmArgs);
-
- String main = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME + suffix, (String)null);
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, main);
-
- String workingDir = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + suffix, (String)null);
- workingCopy.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir);
-
-
- List classpath = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH + suffix, new ArrayList());
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath);
-
- if( STOP.equals(action) || TWIDDLE.equals(action))
- addCredentials(workingCopy, getJBossServer(workingCopy));
-
- } catch( Exception e ) {
- e.printStackTrace();
- }
-
- }
-
-
- protected static void addCredentials(ILaunchConfigurationWorkingCopy configuration, JBossServer server) {
- try {
- String argsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS;
- String args = configuration.getAttribute(argsKey, (String)null);
- String user = ArgsUtil.getValue(args, "-u", "--user");
- String pass = ArgsUtil.getValue(args, "-p", "--password");
- if( user == null && server.getUsername() != null && !server.getUsername().equals(""))
- args = args + " -u " + server.getUsername();
- if( pass == null && server.getPassword() != null && !server.getPassword().equals(""))
- args = args + " -p " + server.getPassword();
-
- configuration.setAttribute(argsKey, args);
- } catch( CoreException ce ) {
- ce.printStackTrace();
- }
- }
-
-
- // Have the defaults been set for this launch config yet? ever?
- public static boolean defaultsBeenSet(ILaunchConfiguration workingCopy, IServer server) {
- try {
- return workingCopy.getAttribute(DEFAULT_SETTINGS, false);
- } catch( CoreException ce ) {
- }
- return false;
- }
-
-
- /**
- * Will create a launch configuration for the server
- * if one does not already exist.
- */
- public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server) throws CoreException {
- ILaunchConfigurationType launchConfigType =
- ((ServerType) server.getServerType()).getLaunchConfigurationType();
- if (launchConfigType == null)
- return null;
-
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfiguration[] launchConfigs = null;
- try {
- launchConfigs = launchManager.getLaunchConfigurations(launchConfigType);
- } catch (CoreException e) {
- // ignore
- }
-
- if (launchConfigs != null) {
- int size = launchConfigs.length;
- for (int i = 0; i < size; i++) {
- try {
- String serverId = launchConfigs[i].getAttribute("server-id", (String) null);
- if (server.getId().equals(serverId)) {
- ILaunchConfigurationWorkingCopy wc = launchConfigs[i].getWorkingCopy();
- return wc;
- }
- } catch (CoreException e) {
- }
- }
- }
-
- // create a new launch configuration
- String launchName = getValidLaunchConfigurationName(server.getName());
- launchName = launchManager.generateUniqueLaunchConfigurationNameFrom(launchName);
- ILaunchConfigurationWorkingCopy wc = launchConfigType.newInstance(null, launchName);
- wc.setAttribute("server-id", server.getId());
- return wc;
- }
-
- protected static String getValidLaunchConfigurationName(String s) {
- if (s == null || s.length() == 0)
- return "1";
- int size = INVALID_CHARS.length;
- for (int i = 0; i < size; i++) {
- s = s.replace(INVALID_CHARS[i], '_');
- }
- return s;
- }
-
-
- public void launch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
-
- try {
- String action = configuration.getAttribute(CURRENT_ACTION, START);
-
- IProcess[] processes = new IProcess[0];
- JBossServerBehavior jbossServerBehavior = getServerBehavior(configuration);
- String serverID = jbossServerBehavior.getServer().getId();
- if( action.equals(START)) {
- processes = launchConfiguration(configuration, launch, monitor, mode);
- jbossServerBehavior.setProcess(processes[0]);
- jbossServerBehavior.serverStarting();
- } else if( action.equals(STOP)) {
- processes = launchConfiguration(configuration, launch, monitor, mode);
- jbossServerBehavior.serverStopping();
- } else if( action.equals(TWIDDLE)) {
- processes = launchConfiguration(configuration, launch, monitor, mode);
- }
- } catch( Exception e ) {
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error launching twiddle", e));
- }
- }
-
- public IProcess[] launchConfiguration(ILaunchConfiguration configuration, ILaunch launch,
- IProgressMonitor monitor, String mode) throws CoreException {
-
- // And off we go!
- IVMInstall vm = verifyVMInstall(configuration);
- IVMRunner runner = vm.getVMRunner(mode);
-
- File workingDir = verifyWorkingDirectory(configuration);
- String workingDirName = null;
- if (workingDir != null)
- workingDirName = workingDir.getAbsolutePath();
-
- // Program & VM args
- String pgmArgs = getProgramArguments(configuration);
- String vmArgs = getVMArguments(configuration);
-
-
- ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
-
- // VM-specific attributes
- Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
-
- // Classpath
- String[] classpath = getClasspath(configuration);
-
- // Create VM config
- String mainType = getMainTypeName(configuration);
- VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainType, classpath);
- runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
- runConfig.setVMArguments(execArgs.getVMArgumentsArray());
- runConfig.setWorkingDirectory(workingDirName);
- runConfig.setVMSpecificAttributesMap(vmAttributesMap);
-
- // Bootpath
- String[] bootpath = getBootpath(configuration);
- if (bootpath != null && bootpath.length > 0)
- runConfig.setBootClassPath(bootpath);
-
- setDefaultSourceLocator(launch, configuration);
-
- // Launch the configuration
- runner.run(runConfig, launch, monitor);
-
- return launch.getProcesses();
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/TwiddleLauncher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/TwiddleLauncher.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/TwiddleLauncher.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -1,227 +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.server;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.wst.server.core.IServer;
-
-public class TwiddleLauncher {
-
- /**
- * Create one launch for each String of arguments.
- * Each element in the array is a COMPLETE LIST of arguments.
- * For example:
- * twiddleArgs[0] = "-s localhost:1099 -a jmx/rmi/RMIAdaptor get \"whatever\""
- * twiddleArgs[1] = "-s localhost:1099 -a jmx/rmi/RMIAdaptor get \"whatever2\""
- *
- * @param twiddleArgs
- * @param jbServer
- * @param seed
- * @return
- */
- public static ProcessData[] launchTwiddles(String[] twiddleArgs, IServer server, boolean addPrefix) throws CoreException {
- ILaunchConfigurationWorkingCopy wc;
- ArrayList list = new ArrayList();
- for( int i = 0; i < twiddleArgs.length; i++ ) {
- wc = createTwiddleLaunch(server, twiddleArgs[i], addPrefix);
- ILaunch launch = wc.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor(), false, false);
- list.addAll(Arrays.asList(toProcessDatas(launch.getProcesses())));
- }
-
- ProcessData[] ret = new ProcessData[list.size()];
- list.toArray(ret);
-
- return ret;
- }
-
- protected static ProcessData[] toProcessDatas(IProcess[] processes) {
- ProcessData[] datas = new ProcessData[processes.length];
- for( int i = 0; i < processes.length; i++ ) {
- datas[i] = new ProcessData(processes[i], "");
- datas[i].startListening();
- }
- return datas;
- }
-
- public static ILaunchConfigurationWorkingCopy createTwiddleLaunch(IServer server,
- String args, boolean addPrefix) throws CoreException {
-
- ILaunchConfigurationWorkingCopy workingCopy =
- JBossServerLaunchConfiguration.setupLaunchConfiguration(server, JBossServerLaunchConfiguration.TWIDDLE);
-
- // If we have to use the prefix from the launch config, throw it in front.
- if( addPrefix ) {
- String a2 = workingCopy.getAttribute(
- IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS
- + JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX, "");
- args = a2 + " " + args;
- }
-
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args);
- return workingCopy;
- }
-
- private boolean canceled = false;
- private int delay = 500;
-
- public void setCanceled() {
- canceled = true;
- }
-
- public ProcessData[] getTwiddleResults(IServer server, String args, boolean addPrefix ) {
- ProcessData[] processes;
- try {
- processes = TwiddleLauncher.launchTwiddles(new String[] { args }, server, addPrefix);
- } catch( CoreException ce ) {
- return new ProcessData[0];
- }
- waitForThreadsToTerminate(processes);
-
- // stop listening
- for( int i = 0; i < processes.length; i++ ) {
- processes[i].stopListening();
- if( canceled ) {
- try {
- // if canceled, terminate all twiddle processes
- processes[i].getProcess().terminate();
- } catch( Exception e ) {}
- }
- }
-
- return processes;
- }
-
- protected void waitForThreadsToTerminate(ProcessData[] processes) {
- boolean allTerminated = false;
- while( !allTerminated && !canceled) {
- allTerminated = true;
- for( int i = 0; i < processes.length; i++ ) {
- if( processes[i].getProcess().isTerminated() == false ) {
- allTerminated = false;
- }
- }
- if( !allTerminated ) {
- // sleep
- try {
- Thread.sleep(delay);
- } catch( InterruptedException ie ) {
- }
- }
- }
- }
-
- public static class ProcessData implements IStreamListener {
- private String args;
- private String processType;
-
- private IProcess process;
- private IStreamMonitor outMonitor;
- private IStreamMonitor errMonitor;
-
- private String out, err;
-
- public ProcessData(IProcess process, String processType) {
- this(null, process, processType);
- try {
- this.args = process.getLaunch().getLaunchConfiguration().
- getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, (String)null);
- } catch( CoreException ce ) {
- }
-
- }
-
- public ProcessData(String args, IProcess process, String processType) {
- this.args = args;
- this.process = process;
- this.processType = processType;
-
- //ASDebug.p("process is " + process, this);
- //ASDebug.p("Stream Proxy is " + process.getStreamsProxy(), this);
- this.outMonitor = process.getStreamsProxy().getOutputStreamMonitor();
- this.errMonitor = process.getStreamsProxy().getErrorStreamMonitor();
-
- out = "";
- err = "";
- }
-
- public void startListening() {
- outMonitor.addListener(this);
- errMonitor.addListener(this);
- }
-
- public void stopListening() {
- outMonitor.removeListener(this);
- errMonitor.removeListener(this);
- }
-
- public void resetStrings() {
- out = "";
- err = "";
- }
-
- public void destroy() {
- stopListening();
- resetStrings();
- }
-
- public void streamAppended(String text, IStreamMonitor monitor) {
- if( monitor == outMonitor ) {
- out += text;
- } else if( monitor == errMonitor ) {
- err += text;
- }
- }
-
- public String getArgs() {
- return args;
- }
-
- public String getErr() {
- return err;
- }
-
- public String getOut() {
- return out;
- }
-
- public String getProcesType() {
- return processType;
- }
-
- public IProcess getProcess() {
- return process;
- }
-
- }
-
-}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableLaunchConfiguration.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableLaunchConfiguration.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -1,33 +0,0 @@
-package org.jboss.ide.eclipse.as.core.server.stripped;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.jboss.ide.eclipse.as.core.server.JBossServerBehavior;
-
-public class DeployableLaunchConfiguration implements
- ILaunchConfigurationDelegate {
-
- public static final String ACTION_KEY = "org.jboss.ide.eclipse.as.core.server.stripped.DeployableLaunchConfiguration.Action";
- public static final String START = "_START_";
- public static final String STOP = "_STOP_";
-
- public static DeployableServerBehavior getServerBehavior(ILaunchConfiguration configuration) throws CoreException {
- IServer server = ServerUtil.getServer(configuration);
- DeployableServerBehavior jbossServerBehavior = (DeployableServerBehavior) server.getAdapter(DeployableServerBehavior.class);
- return jbossServerBehavior;
- }
-
- public void launch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
- String action = configuration.getAttribute(ACTION_KEY, START);
- DeployableServerBehavior behavior = getServerBehavior(configuration);
- if( START.equals(action)) behavior.setServerStarted();
- if( STOP.equals(action)) behavior.setServerStopped();
- }
-}
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-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/stripped/DeployableServerBehavior.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -17,6 +17,7 @@
import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.model.PublishOperation;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.launch.DeployableLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.model.EventLogModel;
import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.packages.PackageModuleFactory;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java 2007-09-06 04:52:37 UTC (rev 3467)
@@ -66,9 +66,9 @@
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.internal.ServerType;
+import org.jboss.ide.eclipse.as.core.launch.JBossServerStartupLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.runtime.server.AbstractJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -84,345 +84,346 @@
*/
public class ASLaunchConfigurationConverter {
-
- public TempLaunchConfiguration[] getConvertableConfigurations() {
- TempLaunchConfiguration[] cfgs = getAllLaunchConfigurations();
- ArrayList result = new ArrayList();
- try {
- for( int i = 0; i < cfgs.length; i++ ) {
- int type = cfgs[i].getLaunchType();
- // If it only has the private key and the type key, its a stub
- if( type != -1 && cfgs[i].getAttributes().keySet().size() > 2) {
- result.add(cfgs[i]);
- }
- }
- } catch( CoreException ce) {
- ce.printStackTrace();
- }
- return (TempLaunchConfiguration[]) result.toArray(new TempLaunchConfiguration[result.size()]);
- }
-
-
- public void convertConfiguration(TempLaunchConfiguration configuration,
- String runtimeName, String serverName) throws CoreException {
- int type = configuration.getLaunchType();
-
- // need name, directory, jre, configuration
- String homeDir = configuration.getAttribute(TempLaunchConfiguration.HOME_DIR_KEY, (String)null);
- String configName = configuration.getAttribute(TempLaunchConfiguration.CONFIGURATION_KEY, (String)null);
- IVMInstall vm = configuration.getJVMItem();
-
- IRuntimeType runtimeType = getRuntimeType(type);
- IServerType serverType = getServerType(type);
-
- try {
- IServerWorkingCopy newServerWC = serverType.createServer(null, null, null, null);
- IRuntimeWorkingCopy newRuntimeWC = runtimeType.createRuntime("", null);
-
- newRuntimeWC.setName(runtimeName);
- newRuntimeWC.setLocation(new Path(homeDir));
- ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, vm.getId());
- ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, vm.getVMInstallType().getId());
- ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configName);
- IRuntime runtime = newRuntimeWC.save(true, null);
-
- AbstractJBossServerRuntime newJBRuntime = (AbstractJBossServerRuntime)newRuntimeWC
- .loadAdapter(AbstractJBossServerRuntime.class, null);
- newJBRuntime.setVMInstall(vm);
-
-
- newServerWC.setRuntime(runtime);
-
- IFolder configFolder = ServerType.getServerProject().getFolder(serverName);
- if( !configFolder.exists() ) {
- configFolder.create(true, true, null);
- }
-
- newServerWC.setServerConfiguration(configFolder);
- newServerWC.setName(serverName);
-
- IServer savedServer = newServerWC.save(true, null);
-
- ILaunchConfiguration launchConfig =
- ((Server)savedServer).getLaunchConfiguration(true, new NullProgressMonitor());
- ILaunchConfigurationWorkingCopy lcwc = launchConfig.getWorkingCopy();
-
- // now lets set some launch config properties
- String startSuffix = JBossServerLaunchConfiguration.PRGM_ARGS_START_SUFFIX;
- String stopSuffix = JBossServerLaunchConfiguration.PRGM_ARGS_STOP_SUFFIX;
- String twiddleSuffix = JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX;
-
- String startArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + startSuffix;
- String startVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + startSuffix;
- String startWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + startSuffix;
-
- String stopArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + stopSuffix;
- String stopVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + stopSuffix;
- String stopWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + stopSuffix;
-
- String twiddleArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + twiddleSuffix;
- String twiddleVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + twiddleSuffix;
- String twiddleWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + twiddleSuffix;
-
- String startArgs = configuration.getAttribute("org.rocklet.launcher.userProgramArgs", (String)null);
- String startVMArgs = configuration.getAttribute("org.rocklet.launcher.UserVMArgs", (String)null);
-
- String shutdownArgs = configuration.getAttribute("org.rocklet.launcher.userShutdownProgramArgs", (String)null);
- String shutdownVMArgs = configuration.getAttribute("org.rocklet.launcher.userShutdownVMArgs", (String)null);
-
- String sourceMementoKey="org.eclipse.debug.core.source_locator_memento";
- String sourceLocatorKey="org.eclipse.debug.core.source_locator_id";
- String sourceMemento=configuration.getAttribute(sourceMementoKey, (String)null);
- String sourceLocator=configuration.getAttribute(sourceLocatorKey, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
-
- lcwc.setAttribute(startArgsKey, startArgs);
- lcwc.setAttribute(startVMArgsKey, startVMArgs);
- lcwc.setAttribute(stopArgsKey, shutdownArgs);
- lcwc.setAttribute(stopVMArgsKey, shutdownVMArgs);
- lcwc.setAttribute(sourceMementoKey, sourceMemento);
- lcwc.setAttribute(sourceLocatorKey, sourceLocator);
-
- lcwc.doSave();
-
-
- } catch( CoreException ce) {
- ce.printStackTrace();
- }
- }
-
-
- private IRuntimeType getRuntimeType(int version) {
- String runtimeKey = "org.jboss.ide.eclipse.as.runtime." + version;
- return ServerCore.findRuntimeType(runtimeKey);
- }
-
- private IServerType getServerType(int version) {
- String serverKey = "org.jboss.ide.eclipse.as." + version;
- return ServerCore.findServerType(serverKey);
- }
-
-
-
- protected TempLaunchConfiguration[] getAllLaunchConfigurations() {
- IPath containerPath =
- DebugPlugin.getDefault().getStateLocation().append(".launches");
-
- List configs = new ArrayList(10);
- final File directory = containerPath.toFile();
- if (directory.isDirectory()) {
- FilenameFilter filter = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return dir.equals(directory) &&
- name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
- }
- };
- String[] files = directory.list(filter);
- for (int i = 0; i < files.length; i++) {
- TempLaunchConfiguration config = new TempLaunchConfiguration(containerPath.append(files[i]));
- configs.add(config);
- }
- }
-
- return (TempLaunchConfiguration[]) configs.toArray(new TempLaunchConfiguration[configs.size()]);
- }
-
- public class TempLaunchConfiguration extends LaunchConfiguration {
- public static final String JBOSS_32_CONFIG = "org.jboss.ide.eclipse.launcher.configuration.jboss.JBoss32xLaunchConfigurationDelegate";
- public static final String JBOSS_40_CONFIG = "org.jboss.ide.eclipse.launcher.configuration.jboss.JBoss40xLaunchConfigurationDelegate";
- public static final String LAUNCH_CONFIG_TYPE = "_LAUNCH_CONFIG_TYPE_";
-
- public static final String HOME_DIR_KEY = "org.jboss.rocklet.HomeDir";
- public static final String CONFIGURATION_KEY = "org.jboss.rocklet.ServerConfiguration";
-
-
- private TempLaunchConfigurationInfo info = null;
-
- protected TempLaunchConfiguration(IPath location) {
- super(location);
- }
-
- protected LaunchConfigurationInfo getInfo() throws CoreException {
- return managerGetInfo(this);
- }
-
- // returns 32, 40, or -1
- public int getLaunchType() {
- try {
- if( info == null ) managerGetInfo(this);
-
- String type = getAttribute(LAUNCH_CONFIG_TYPE, (String)null);
- if( type == null ) return -1;
-
- if( type.equals(JBOSS_32_CONFIG)) return 32;
- if( type.equals(JBOSS_40_CONFIG)) return 40;
- } catch( Exception e ) {
- }
- return -1;
- }
-
- public IVMInstall getJVMItem() throws CoreException {
- List cp = getAttribute("org.rocklet.launcher.JDKClasspath", (List)null);
- ArrayList vms = new ArrayList();
- IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
- for( int i = 0; i < vmTypes.length; i++ ) {
- vms.addAll(Arrays.asList(vmTypes[i].getVMInstalls()));
- }
- IVMInstall[] vms2 = (IVMInstall[]) vms.toArray(new IVMInstall[vms.size()]);
-
- Iterator i = cp.iterator();
- while(i.hasNext()) {
- Path cpItemPath = new Path((String)i.next());
- for( int j = 0; j < vms2.length; j++ ) {
- try {
- Path vmPath = new Path(vms2[j].getInstallLocation().toURL().getPath());
- IPath vmPath2 = vmPath.append("lib").append("tools.jar");
- if( cpItemPath.equals(vmPath2) ) {
- return vms2[j];
- }
- } catch( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
- return JavaRuntime.getDefaultVMInstall();
- }
-
-
- protected LaunchConfigurationInfo managerGetInfo(ILaunchConfiguration config) throws CoreException {
- if (info == null) {
- if (config.exists()) {
- InputStream stream = null;
- try {
- if (config.isLocal()) {
- IPath path = config.getLocation();
- File file = path.toFile();
- stream = new FileInputStream(file);
- } else {
- IFile file = ((LaunchConfiguration) config).getFile();
- if (file == null) {
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_30, new String[] {config.getName()}), null);
- }
- stream = file.getContents();
- }
- info = (TempLaunchConfigurationInfo)createInfoFromXML(stream);
- } catch (FileNotFoundException e) {
- throwException(config, e);
- } catch (SAXException e) {
- throwException(config, e);
- } catch (ParserConfigurationException e) {
- throwException(config, e);
- } catch (IOException e) {
- throwException(config, e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- throwException(config, e);
- }
- }
- }
-
- } else {
- throw createDebugException(
- MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new String[]{config.getName(), config.getLocation().toOSString()}), null);
- }
- }
- return info;
- }
-
- private void throwException(ILaunchConfiguration config, Throwable e) throws DebugException {
- IPath path = config.getLocation();
- throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager__0__occurred_while_reading_launch_configuration_file__1___1, new String[]{e.toString(), path.toOSString()}), e);
- }
-
- protected DebugException createDebugException(String message, Throwable throwable) {
- return new DebugException(
- new Status(
- IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
- DebugException.REQUEST_FAILED, message, throwable
- )
- );
- }
-
-
- protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) throws CoreException,
- ParserConfigurationException,
- IOException,
- SAXException {
- Element root = null;
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- parser.setErrorHandler(new DefaultHandler());
- root = parser.parse(new InputSource(stream)).getDocumentElement();
- TempLaunchConfigurationInfo info = new TempLaunchConfigurationInfo();
- info.initializeFromXML(root);
- return info;
- }
-
-
- }
-
- protected class TempLaunchConfigurationInfo extends LaunchConfigurationInfo {
-
- protected void initializeFromXML(Element root) throws CoreException {
-
-
-// boolean val = true;
-// if( val ) {
-// super.initializeFromXML(root);
-// return;
+//
+// public TempLaunchConfiguration[] getConvertableConfigurations() {
+// TempLaunchConfiguration[] cfgs = getAllLaunchConfigurations();
+// ArrayList result = new ArrayList();
+// try {
+// for( int i = 0; i < cfgs.length; i++ ) {
+// int type = cfgs[i].getLaunchType();
+// // If it only has the private key and the type key, its a stub
+// if( type != -1 && cfgs[i].getAttributes().keySet().size() > 2) {
+// result.add(cfgs[i]);
+// }
// }
-
-
- if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
- throw getInvalidFormatDebugException();
- }
-
- // read type
- String id = root.getAttribute("type"); //$NON-NLS-1$
- if (id == null) {
- throw getInvalidFormatDebugException();
- }
-
- // Commenting out as it causes an exception. (Configuration type not found)
-// ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
-// if (type == null) {
-// String message= MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_missing_type, new Object[]{id});
-// throw new DebugException(
+// } catch( CoreException ce) {
+// ce.printStackTrace();
+// }
+// return (TempLaunchConfiguration[]) result.toArray(new TempLaunchConfiguration[result.size()]);
+// }
+//
+//
+// public void convertConfiguration(TempLaunchConfiguration configuration,
+// String runtimeName, String serverName) throws CoreException {
+// int type = configuration.getLaunchType();
+//
+// // need name, directory, jre, configuration
+// String homeDir = configuration.getAttribute(TempLaunchConfiguration.HOME_DIR_KEY, (String)null);
+// String configName = configuration.getAttribute(TempLaunchConfiguration.CONFIGURATION_KEY, (String)null);
+// IVMInstall vm = configuration.getJVMItem();
+//
+// IRuntimeType runtimeType = getRuntimeType(type);
+// IServerType serverType = getServerType(type);
+//
+// try {
+// IServerWorkingCopy newServerWC = serverType.createServer(null, null, null, null);
+// IRuntimeWorkingCopy newRuntimeWC = runtimeType.createRuntime("", null);
+//
+// newRuntimeWC.setName(runtimeName);
+// newRuntimeWC.setLocation(new Path(homeDir));
+// ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_ID, vm.getId());
+// ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_VM_TYPE_ID, vm.getVMInstallType().getId());
+// ((RuntimeWorkingCopy)newRuntimeWC).setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME, configName);
+// IRuntime runtime = newRuntimeWC.save(true, null);
+//
+// AbstractJBossServerRuntime newJBRuntime = (AbstractJBossServerRuntime)newRuntimeWC
+// .loadAdapter(AbstractJBossServerRuntime.class, null);
+// newJBRuntime.setVMInstall(vm);
+//
+//
+// newServerWC.setRuntime(runtime);
+//
+// IFolder configFolder = ServerType.getServerProject().getFolder(serverName);
+// if( !configFolder.exists() ) {
+// configFolder.create(true, true, null);
+// }
+//
+// newServerWC.setServerConfiguration(configFolder);
+// newServerWC.setName(serverName);
+//
+// IServer savedServer = newServerWC.save(true, null);
+//
+// ILaunchConfiguration launchConfig =
+// ((Server)savedServer).getLaunchConfiguration(true, new NullProgressMonitor());
+// ILaunchConfigurationWorkingCopy lcwc = launchConfig.getWorkingCopy();
+//
+// // now lets set some launch config properties
+// String startSuffix = JBossServerStartupLaunchConfiguration.PRGM_ARGS_START_SUFFIX;
+// String stopSuffix = JBossServerStartupLaunchConfiguration.PRGM_ARGS_STOP_SUFFIX;
+// //String twiddleSuffix = JBossServerLaunchConfiguration.PRGM_ARGS_TWIDDLE_SUFFIX;
+// String twiddleSuffix = "";
+//
+// String startArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + startSuffix;
+// String startVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + startSuffix;
+// String startWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + startSuffix;
+//
+// String stopArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + stopSuffix;
+// String stopVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + stopSuffix;
+// String stopWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + stopSuffix;
+//
+// String twiddleArgsKey = IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS + twiddleSuffix;
+// String twiddleVMArgsKey = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS + twiddleSuffix;
+// String twiddleWorkingDirKey = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY + twiddleSuffix;
+//
+// String startArgs = configuration.getAttribute("org.rocklet.launcher.userProgramArgs", (String)null);
+// String startVMArgs = configuration.getAttribute("org.rocklet.launcher.UserVMArgs", (String)null);
+//
+// String shutdownArgs = configuration.getAttribute("org.rocklet.launcher.userShutdownProgramArgs", (String)null);
+// String shutdownVMArgs = configuration.getAttribute("org.rocklet.launcher.userShutdownVMArgs", (String)null);
+//
+// String sourceMementoKey="org.eclipse.debug.core.source_locator_memento";
+// String sourceLocatorKey="org.eclipse.debug.core.source_locator_id";
+// String sourceMemento=configuration.getAttribute(sourceMementoKey, (String)null);
+// String sourceLocator=configuration.getAttribute(sourceLocatorKey, "org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector");
+//
+// lcwc.setAttribute(startArgsKey, startArgs);
+// lcwc.setAttribute(startVMArgsKey, startVMArgs);
+// lcwc.setAttribute(stopArgsKey, shutdownArgs);
+// lcwc.setAttribute(stopVMArgsKey, shutdownVMArgs);
+// lcwc.setAttribute(sourceMementoKey, sourceMemento);
+// lcwc.setAttribute(sourceLocatorKey, sourceLocator);
+//
+// lcwc.doSave();
+//
+//
+// } catch( CoreException ce) {
+// ce.printStackTrace();
+// }
+// }
+//
+//
+// private IRuntimeType getRuntimeType(int version) {
+// String runtimeKey = "org.jboss.ide.eclipse.as.runtime." + version;
+// return ServerCore.findRuntimeType(runtimeKey);
+// }
+//
+// private IServerType getServerType(int version) {
+// String serverKey = "org.jboss.ide.eclipse.as." + version;
+// return ServerCore.findServerType(serverKey);
+// }
+//
+//
+//
+// protected TempLaunchConfiguration[] getAllLaunchConfigurations() {
+// IPath containerPath =
+// DebugPlugin.getDefault().getStateLocation().append(".launches");
+//
+// List configs = new ArrayList(10);
+// final File directory = containerPath.toFile();
+// if (directory.isDirectory()) {
+// FilenameFilter filter = new FilenameFilter() {
+// public boolean accept(File dir, String name) {
+// return dir.equals(directory) &&
+// name.endsWith(ILaunchConfiguration.LAUNCH_CONFIGURATION_FILE_EXTENSION);
+// }
+// };
+// String[] files = directory.list(filter);
+// for (int i = 0; i < files.length; i++) {
+// TempLaunchConfiguration config = new TempLaunchConfiguration(containerPath.append(files[i]));
+// configs.add(config);
+// }
+// }
+//
+// return (TempLaunchConfiguration[]) configs.toArray(new TempLaunchConfiguration[configs.size()]);
+// }
+//
+// public class TempLaunchConfiguration extends LaunchConfiguration {
+// public static final String JBOSS_32_CONFIG = "org.jboss.ide.eclipse.launcher.configuration.jboss.JBoss32xLaunchConfigurationDelegate";
+// public static final String JBOSS_40_CONFIG = "org.jboss.ide.eclipse.launcher.configuration.jboss.JBoss40xLaunchConfigurationDelegate";
+// public static final String LAUNCH_CONFIG_TYPE = "_LAUNCH_CONFIG_TYPE_";
+//
+// public static final String HOME_DIR_KEY = "org.jboss.rocklet.HomeDir";
+// public static final String CONFIGURATION_KEY = "org.jboss.rocklet.ServerConfiguration";
+//
+//
+// private TempLaunchConfigurationInfo info = null;
+//
+// protected TempLaunchConfiguration(IPath location) {
+// super(location);
+// }
+//
+// protected LaunchConfigurationInfo getInfo() throws CoreException {
+// return managerGetInfo(this);
+// }
+//
+// // returns 32, 40, or -1
+// public int getLaunchType() {
+// try {
+// if( info == null ) managerGetInfo(this);
+//
+// String type = getAttribute(LAUNCH_CONFIG_TYPE, (String)null);
+// if( type == null ) return -1;
+//
+// if( type.equals(JBOSS_32_CONFIG)) return 32;
+// if( type.equals(JBOSS_40_CONFIG)) return 40;
+// } catch( Exception e ) {
+// }
+// return -1;
+// }
+//
+// public IVMInstall getJVMItem() throws CoreException {
+// List cp = getAttribute("org.rocklet.launcher.JDKClasspath", (List)null);
+// ArrayList vms = new ArrayList();
+// IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
+// for( int i = 0; i < vmTypes.length; i++ ) {
+// vms.addAll(Arrays.asList(vmTypes[i].getVMInstalls()));
+// }
+// IVMInstall[] vms2 = (IVMInstall[]) vms.toArray(new IVMInstall[vms.size()]);
+//
+// Iterator i = cp.iterator();
+// while(i.hasNext()) {
+// Path cpItemPath = new Path((String)i.next());
+// for( int j = 0; j < vms2.length; j++ ) {
+// try {
+// Path vmPath = new Path(vms2[j].getInstallLocation().toURL().getPath());
+// IPath vmPath2 = vmPath.append("lib").append("tools.jar");
+// if( cpItemPath.equals(vmPath2) ) {
+// return vms2[j];
+// }
+// } catch( Exception e ) {
+// e.printStackTrace();
+// }
+// }
+// }
+//
+// return JavaRuntime.getDefaultVMInstall();
+// }
+//
+//
+// protected LaunchConfigurationInfo managerGetInfo(ILaunchConfiguration config) throws CoreException {
+// if (info == null) {
+// if (config.exists()) {
+// InputStream stream = null;
+// try {
+// if (config.isLocal()) {
+// IPath path = config.getLocation();
+// File file = path.toFile();
+// stream = new FileInputStream(file);
+// } else {
+// IFile file = ((LaunchConfiguration) config).getFile();
+// if (file == null) {
+// throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager_30, new String[] {config.getName()}), null);
+// }
+// stream = file.getContents();
+// }
+// info = (TempLaunchConfigurationInfo)createInfoFromXML(stream);
+// } catch (FileNotFoundException e) {
+// throwException(config, e);
+// } catch (SAXException e) {
+// throwException(config, e);
+// } catch (ParserConfigurationException e) {
+// throwException(config, e);
+// } catch (IOException e) {
+// throwException(config, e);
+// } finally {
+// if (stream != null) {
+// try {
+// stream.close();
+// } catch (IOException e) {
+// throwException(config, e);
+// }
+// }
+// }
+//
+// } else {
+// throw createDebugException(
+// MessageFormat.format(DebugCoreMessages.LaunchManager_does_not_exist, new String[]{config.getName(), config.getLocation().toOSString()}), null);
+// }
+// }
+// return info;
+// }
+//
+// private void throwException(ILaunchConfiguration config, Throwable e) throws DebugException {
+// IPath path = config.getLocation();
+// throw createDebugException(MessageFormat.format(DebugCoreMessages.LaunchManager__0__occurred_while_reading_launch_configuration_file__1___1, new String[]{e.toString(), path.toOSString()}), e);
+// }
+//
+// protected DebugException createDebugException(String message, Throwable throwable) {
+// return new DebugException(
// new Status(
// IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
-// DebugException.MISSING_LAUNCH_CONFIGURATION_TYPE, message, null)
+// DebugException.REQUEST_FAILED, message, throwable
+// )
// );
+// }
+//
+//
+// protected LaunchConfigurationInfo createInfoFromXML(InputStream stream) throws CoreException,
+// ParserConfigurationException,
+// IOException,
+// SAXException {
+// Element root = null;
+// DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+// parser.setErrorHandler(new DefaultHandler());
+// root = parser.parse(new InputSource(stream)).getDocumentElement();
+// TempLaunchConfigurationInfo info = new TempLaunchConfigurationInfo();
+// info.initializeFromXML(root);
+// return info;
+// }
+//
+//
+// }
+//
+// protected class TempLaunchConfigurationInfo extends LaunchConfigurationInfo {
+//
+// protected void initializeFromXML(Element root) throws CoreException {
+//
+//
+//// boolean val = true;
+//// if( val ) {
+//// super.initializeFromXML(root);
+//// return;
+//// }
+//
+//
+// if (!root.getNodeName().equalsIgnoreCase("launchConfiguration")) { //$NON-NLS-1$
+// throw getInvalidFormatDebugException();
// }
-// setType(type);
-
- // instead just set an attribute right now.
- setAttribute(TempLaunchConfiguration.LAUNCH_CONFIG_TYPE, id);
-
- NodeList list = root.getChildNodes();
- int length = list.getLength();
- for (int i = 0; i < length; ++i) {
- Node node = list.item(i);
- short nodeType = node.getNodeType();
- if (nodeType == Node.ELEMENT_NODE) {
- Element element = (Element) node;
- String nodeName = element.getNodeName();
-
- if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
- setStringAttribute(element);
- } else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
- setIntegerAttribute(element);
- } else if (nodeName.equalsIgnoreCase("booleanAttribute")) { //$NON-NLS-1$
- setBooleanAttribute(element);
- } else if (nodeName.equalsIgnoreCase("listAttribute")) { //$NON-NLS-1$
- setListAttribute(element);
- } else if (nodeName.equalsIgnoreCase("mapAttribute")) { //$NON-NLS-1$
- setMapAttribute(element);
- }
- }
- }
- }
- }
+//
+// // read type
+// String id = root.getAttribute("type"); //$NON-NLS-1$
+// if (id == null) {
+// throw getInvalidFormatDebugException();
+// }
+//
+// // Commenting out as it causes an exception. (Configuration type not found)
+//// ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(id);
+//// if (type == null) {
+//// String message= MessageFormat.format(DebugCoreMessages.LaunchConfigurationInfo_missing_type, new Object[]{id});
+//// throw new DebugException(
+//// new Status(
+//// IStatus.ERROR, DebugPlugin.getUniqueIdentifier(),
+//// DebugException.MISSING_LAUNCH_CONFIGURATION_TYPE, message, null)
+//// );
+//// }
+//// setType(type);
+//
+// // instead just set an attribute right now.
+// setAttribute(TempLaunchConfiguration.LAUNCH_CONFIG_TYPE, id);
+//
+// NodeList list = root.getChildNodes();
+// int length = list.getLength();
+// for (int i = 0; i < length; ++i) {
+// Node node = list.item(i);
+// short nodeType = node.getNodeType();
+// if (nodeType == Node.ELEMENT_NODE) {
+// Element element = (Element) node;
+// String nodeName = element.getNodeName();
+//
+// if (nodeName.equalsIgnoreCase("stringAttribute")) { //$NON-NLS-1$
+// setStringAttribute(element);
+// } else if (nodeName.equalsIgnoreCase("intAttribute")) { //$NON-NLS-1$
+// setIntegerAttribute(element);
+// } else if (nodeName.equalsIgnoreCase("booleanAttribute")) { //$NON-NLS-1$
+// setBooleanAttribute(element);
+// } else if (nodeName.equalsIgnoreCase("listAttribute")) { //$NON-NLS-1$
+// setListAttribute(element);
+// } else if (nodeName.equalsIgnoreCase("mapAttribute")) { //$NON-NLS-1$
+// setMapAttribute(element);
+// }
+// }
+// }
+// }
+// }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-06 04:52:32 UTC (rev 3466)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-06 04:52:37 UTC (rev 3467)
@@ -14,7 +14,7 @@
hasConfiguration="false"
id="org.jboss.ide.eclipse.as.32"
initialState="stopped"
- launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
+ launchConfigId="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
launchModes="run,debug"
name="%jboss.version.32.name"
runtime="true"
@@ -31,7 +31,7 @@
hasConfiguration="false"
id="org.jboss.ide.eclipse.as.40"
initialState="stopped"
- launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
+ launchConfigId="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
launchModes="run,debug"
name="%jboss.version.40.name"
runtime="true"
@@ -48,7 +48,7 @@
hasConfiguration="false"
id="org.jboss.ide.eclipse.as.42"
initialState="stopped"
- launchConfigId="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
+ launchConfigId="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
launchModes="run,debug"
name="%jboss.version.42.name"
runtime="true"
@@ -199,21 +199,34 @@
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
category="JBoss"
- delegate="org.jboss.ide.eclipse.as.core.server.JBossServerLaunchConfiguration"
- id="org.jboss.ide.eclipse.as.core.server.launchConfiguration"
+ delegate="org.jboss.ide.eclipse.as.core.launch.JBossServerStartupLaunchConfiguration"
+ id="org.jboss.ide.eclipse.as.core.server.startupConfiguration"
modes="run,debug"
- name="JBoss Application Server"
+ name="JBoss Application Server Startup Configuration"
public="true"
sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
sourcePathComputerId="org.jboss.ide.eclipse.as.core.serverSourcePathComputer"/>
<launchConfigurationType
- delegate="org.jboss.ide.eclipse.as.core.server.stripped.DeployableLaunchConfiguration"
+ delegate="org.jboss.ide.eclipse.as.core.launch.DeployableLaunchConfiguration"
id="org.jboss.ide.eclipse.as.core.server.stripped.launchConfiguration"
modes="run,debug"
name="Stripped Server Launch Configuration"
public="true"
sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
sourcePathComputerId="org.jboss.ide.eclipse.as.core.serverSourcePathComputer"/>
+ <launchConfigurationType
+ delegate="org.jboss.ide.eclipse.as.core.launch.TwiddleLaunchConfiguration"
+ id="org.jboss.ide.eclipse.as.core.server.twiddleConfiguration"
+ modes="run"
+ name="Twiddle"
+ public="false">
+ </launchConfigurationType>
+ <launchConfigurationType
+ delegate="org.jboss.ide.eclipse.as.core.launch.StopLaunchConfiguration"
+ id="org.jboss.ide.eclipse.as.core.server.stopLaunchConfiguration"
+ modes="run"
+ name="Stop Server">
+ </launchConfigurationType>
</extension>
<extension
16 years, 8 months