JBoss Tools SVN: r32640 - in trunk/forge/plugins/org.jboss.tools.forge.ui: src/org/jboss/tools/forge/console and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-07-06 05:43:45 -0400 (Wed, 06 Jul 2011)
New Revision: 32640
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/Console.java
Log:
use new ForgeInputReadJob
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF 2011-07-06 09:41:26 UTC (rev 32639)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/META-INF/MANIFEST.MF 2011-07-06 09:43:45 UTC (rev 32640)
@@ -14,7 +14,8 @@
org.eclipse.m2e.core;bundle-version="[0.13.0,1.0.100)",
org.eclipse.m2e.maven.runtime;bundle-version="[0.13.0,1.0.100)",
org.eclipse.jdt.core,
- org.eclipse.ui.views
+ org.eclipse.ui.views,
+ org.jboss.tools.forge.core;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.forge.ForgeUIPlugin
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/Console.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/Console.java 2011-07-06 09:41:26 UTC (rev 32639)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/Console.java 2011-07-06 09:43:45 UTC (rev 32640)
@@ -14,6 +14,7 @@
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.TextConsole;
import org.eclipse.ui.part.IPageBookViewPage;
+import org.jboss.tools.forge.core.io.ForgeInputReadJob;
public class Console extends TextConsole implements IDebugEventSetListener {
@@ -63,7 +64,7 @@
}
private void initInputReadJob() {
- InputReadJob inputReadJob = new InputReadJob(process.getStreamsProxy(), inputStream);
+ ForgeInputReadJob inputReadJob = new ForgeInputReadJob(process.getStreamsProxy(), inputStream);
inputReadJob.setSystem(true);
inputReadJob.schedule();
}
13 years, 6 months
JBoss Tools SVN: r32639 - in trunk/forge: tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-07-06 05:41:26 -0400 (Wed, 06 Jul 2011)
New Revision: 32639
Added:
trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/io/ForgeInputReadJob.java
trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/io/
trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/io/ForgeInputReadJobTest.java
Log:
implementation and test of ForgeInputReadJob
Added: trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/io/ForgeInputReadJob.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/io/ForgeInputReadJob.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.core/src/org/jboss/tools/forge/core/io/ForgeInputReadJob.java 2011-07-06 09:41:26 UTC (rev 32639)
@@ -0,0 +1,36 @@
+package org.jboss.tools.forge.core.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.jboss.tools.forge.core.ForgeCorePlugin;
+
+public class ForgeInputReadJob extends Job {
+
+ private IStreamsProxy streamsProxy;
+ private InputStream input;
+
+ public ForgeInputReadJob(IStreamsProxy streamsProxy, InputStream input) {
+ super("Forge Input Read Job");
+ this.input = input;
+ this.streamsProxy = streamsProxy;
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ int read;
+ while (input != null && (read = input.read()) != -1) {
+ streamsProxy.write(new String(new char[] { (char)read }));
+ }
+ } catch (IOException e) {
+ ForgeCorePlugin.log(e);
+ }
+ return Status.OK_STATUS;
+ }
+
+}
Added: trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/io/ForgeInputReadJobTest.java
===================================================================
--- trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/io/ForgeInputReadJobTest.java (rev 0)
+++ trunk/forge/tests/org.jboss.tools.forge.core.test/src/org/jboss/tools/forge/core/io/ForgeInputReadJobTest.java 2011-07-06 09:41:26 UTC (rev 32639)
@@ -0,0 +1,66 @@
+package org.jboss.tools.forge.core.io;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.debug.core.model.IStreamMonitor;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ForgeInputReadJobTest {
+
+ private int[] in;
+ private String out;
+
+ @Before
+ public void setUp() {
+ in = null;
+ out = "";
+ }
+
+ @Test
+ public void testNullInput() {
+ ForgeInputReadJob forgeInputReadJob = new ForgeInputReadJob(new TestStreamProxy(), null);
+ forgeInputReadJob.schedule();
+ try {
+ forgeInputReadJob.join();
+ } catch (InterruptedException e) {}
+ assertEquals("", out);
+ }
+
+ @Test
+ public void testNormalInput() {
+ in = new int[] { 'b', 'l', 'a', 'h', -1 };
+ ForgeInputReadJob forgeInputReadJob = new ForgeInputReadJob(new TestStreamProxy(), new TestInputStream());
+ forgeInputReadJob.schedule();
+ try {
+ forgeInputReadJob.join();
+ } catch (InterruptedException e) {}
+ assertEquals("blah", out);
+ }
+
+ private class TestStreamProxy implements IStreamsProxy {
+ public IStreamMonitor getErrorStreamMonitor() {
+ return null;
+ }
+ public IStreamMonitor getOutputStreamMonitor() {
+ return null;
+ }
+ public void write(String str) throws IOException {
+ out += str;
+ }
+ }
+
+ private class TestInputStream extends InputStream {
+ int index = 0;
+ public int read() throws IOException {
+ int result = in.length > index ? in[index] : -1;
+ index++;
+ return result;
+ }
+ }
+
+}
13 years, 6 months
JBoss Tools SVN: r32638 - trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-07-06 05:38:57 -0400 (Wed, 06 Jul 2011)
New Revision: 32638
Removed:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleText.java
Modified:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleViewer.java
Log:
eliminate the use of ConsoleText
Deleted: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleText.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleText.java 2011-07-06 09:32:43 UTC (rev 32637)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleText.java 2011-07-06 09:38:57 UTC (rev 32638)
@@ -1,40 +0,0 @@
-package org.jboss.tools.forge.view;
-
-import org.eclipse.swt.custom.ST;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-
-public class ConsoleText extends StyledText {
-
- public ConsoleText(Composite parent, int style) {
- super(parent, style);
- }
-
- public void invokeAction(int action) {
- checkWidget();
- switch (action) {
- case ST.LINE_UP:
- doLineUp();
- break;
- case ST.LINE_DOWN:
- doLineDown();
- break;
-// case ST.DELETE_PREVIOUS:
-// doDeletePrevious();
-// break;
- default:
- super.invokeAction(action);
- }
- }
-
- private void doLineUp() {
-// System.out.println("Line up");
- }
- private void doLineDown() {
-// System.out.println("Line down");
- }
-// private void doDeletePrevious() {
-// System.out.println("Backspace");
-// }
-
-}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleViewer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleViewer.java 2011-07-06 09:32:43 UTC (rev 32637)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/view/ConsoleViewer.java 2011-07-06 09:38:57 UTC (rev 32638)
@@ -44,8 +44,7 @@
}
protected StyledText createTextWidget(Composite parent, int styles) {
- ConsoleText styledText= new ConsoleText(parent, styles | SWT.WRAP);
- styledText.setLeftMargin(Math.max(styledText.getLeftMargin(), 2));
+ StyledText styledText = super.createTextWidget(parent, styles);
styledText.addKeyListener(new ConsoleKeyListener());
return styledText;
}
13 years, 6 months
JBoss Tools SVN: r32637 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-06 05:32:43 -0400 (Wed, 06 Jul 2011)
New Revision: 32637
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java
Log:
[JBIDe-9054] renamed #ignoreLaunchCommand to #isIgnoreLaunchCommand
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -155,7 +155,7 @@
return canChangeState(launchMode);
}
protected IStatus canChangeState(String launchMode) {
- if( LaunchCommandPreferences.ignoreLaunchCommand(getServer())) {
+ if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
return Status.CANCEL_STATUS;
}
return getDelegate().canChangeState(launchMode);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -108,7 +108,7 @@
JBossServerBehavior jbsBehavior = JBossServerBehaviorUtils.getServerBehavior(configuration);
if (!jbsBehavior.canStart(mode).isOK())
throw new CoreException(jbsBehavior.canStart(mode));
- if (LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
+ if (LaunchCommandPreferences.isIgnoreLaunchCommand(jbsBehavior.getServer())) {
jbsBehavior.setServerStarting();
jbsBehavior.setServerStarted();
return false;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -62,7 +62,7 @@
JBossServerBehavior jbsBehavior = JBossServerBehaviorUtils.getServerBehavior(configuration);
if (!jbsBehavior.canStart(mode).isOK())
throw new CoreException(jbsBehavior.canStart(mode));
- if (LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
+ if (LaunchCommandPreferences.isIgnoreLaunchCommand(jbsBehavior.getServer())) {
jbsBehavior.setServerStarting();
jbsBehavior.setServerStarted();
return false;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -149,7 +149,7 @@
}
public void stop(boolean force) {
- if( LaunchCommandPreferences.ignoreLaunchCommand(getServer())) {
+ if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
super.setServerStopped();
return;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -37,7 +37,7 @@
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)
throws CoreException {
JBossServerBehavior jbsBehavior = JBossServerBehaviorUtils.getServerBehavior(configuration);
- if( LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
+ if( LaunchCommandPreferences.isIgnoreLaunchCommand(jbsBehavior.getServer())) {
jbsBehavior.setServerStarting();
jbsBehavior.setServerStarted();
return false;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -18,11 +18,11 @@
*/
public class LaunchCommandPreferences {
- public static boolean ignoreLaunchCommand(IServerAttributes server) {
- return ignoreLaunchCommand(server, false);
+ public static boolean isIgnoreLaunchCommand(IServerAttributes server) {
+ return isIgnoreLaunchCommand(server, false);
}
- public static boolean ignoreLaunchCommand(IServerAttributes server, boolean defaultValue) {
+ public static boolean isIgnoreLaunchCommand(IServerAttributes server, boolean defaultValue) {
String ignoreCommand = server.getAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, Boolean.toString(defaultValue));
return Boolean.valueOf(ignoreCommand);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -40,7 +40,7 @@
forceStop();
}
- if( LaunchCommandPreferences.ignoreLaunchCommand(getServer())) {
+ if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
serverStopping();
serverStopped();
return;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -58,7 +58,7 @@
IProgressMonitor monitor) throws CoreException {
JBossServerBehavior beh = JBossServerBehaviorUtils.getServerBehavior(configuration);
beh.setServerStarting();
- if (LaunchCommandPreferences.ignoreLaunchCommand(beh.getServer())) {
+ if (LaunchCommandPreferences.isIgnoreLaunchCommand(beh.getServer())) {
beh.setServerStarted();
return;
}
@@ -111,7 +111,7 @@
*/
@Deprecated
public static void launchStopServerCommand(JBossServerBehavior behaviour) {
- if (LaunchCommandPreferences.ignoreLaunchCommand(behaviour.getServer())) {
+ if (LaunchCommandPreferences.isIgnoreLaunchCommand(behaviour.getServer())) {
behaviour.setServerStopping();
behaviour.setServerStopped();
return;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java 2011-07-06 09:22:26 UTC (rev 32636)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerModeSectionComposite.java 2011-07-06 09:32:43 UTC (rev 32637)
@@ -64,7 +64,7 @@
FormData fd = UIUtil.createFormData2(0, 5, null, 0, 0, 5, null, 0);
executeShellScripts.setLayoutData(fd);
top = executeShellScripts;
- executeShellScripts.setSelection(LaunchCommandPreferences.ignoreLaunchCommand(callback.getServer()));
+ executeShellScripts.setSelection(LaunchCommandPreferences.isIgnoreLaunchCommand(callback.getServer()));
executeShellScripts.addSelectionListener(new SelectionListener(){
public void widgetSelected(SelectionEvent e) {
executeShellToggled();
13 years, 6 months
JBoss Tools SVN: r32636 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-06 05:22:26 -0400 (Wed, 06 Jul 2011)
New Revision: 32636
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java
Log:
[JBIDe-9054] added method that allows to indicate the default
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java 2011-07-06 09:21:52 UTC (rev 32635)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/LaunchCommandPreferences.java 2011-07-06 09:22:26 UTC (rev 32636)
@@ -13,10 +13,17 @@
import org.eclipse.wst.server.core.IServerAttributes;
+/**
+ * @author André Dietisheim
+ */
public class LaunchCommandPreferences {
public static boolean ignoreLaunchCommand(IServerAttributes server) {
- String ignoreCommand = server.getAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, (String) null);
+ return ignoreLaunchCommand(server, false);
+ }
+
+ public static boolean ignoreLaunchCommand(IServerAttributes server, boolean defaultValue) {
+ String ignoreCommand = server.getAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, Boolean.toString(defaultValue));
return Boolean.valueOf(ignoreCommand);
}
13 years, 6 months
JBoss Tools SVN: r32635 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-06 05:21:52 -0400 (Wed, 06 Jul 2011)
New Revision: 32635
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
Log:
[JBIDe-9054] replaced direct attribute access by centralized util class
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 09:17:17 UTC (rev 32634)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 09:21:52 UTC (rev 32635)
@@ -32,6 +32,7 @@
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
@@ -154,8 +155,7 @@
return canChangeState(launchMode);
}
protected IStatus canChangeState(String launchMode) {
- String ignoreLaunch = getServer().getAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, Boolean.toString(false));
- if( new Boolean(ignoreLaunch).booleanValue()) {
+ if( LaunchCommandPreferences.ignoreLaunchCommand(getServer())) {
return Status.CANCEL_STATUS;
}
return getDelegate().canChangeState(launchMode);
13 years, 6 months
JBoss Tools SVN: r32634 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-07-06 05:17:17 -0400 (Wed, 06 Jul 2011)
New Revision: 32634
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties
Log:
JBIDE-9274 - refactor hte class to use restart module logic instead
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties 2011-07-06 09:16:04 UTC (rev 32633)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/messages.properties 2011-07-06 09:17:17 UTC (rev 32634)
@@ -5,7 +5,7 @@
SELECT_A_SERVER=Select a default server
SelectServerActionDelegate_NewServerMenuItem=New server...
STOP_SERVER=Shutdown {0}
-CHANGE_TIME_STAMP=Change Timestamp of {0}
-CHANGE_TIME_STAMP_DEFAULT=Touch descriptors
+CHANGE_TIME_STAMP=Restart Module {0}
+CHANGE_TIME_STAMP_DEFAULT=Restart Module
ChangeTimeStampActionDelegate_cannot_unregister=Cannot unregister project {0} from server {1}
ChangeTimeStampActionDelegate_could_not_register_project=Could not register project {0}
13 years, 6 months
JBoss Tools SVN: r32633 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-07-06 05:16:04 -0400 (Wed, 06 Jul 2011)
New Revision: 32633
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ChangeTimeStampActionDelegate.java
Log:
JBIDE-9274 - refactor hte class to use restart module logic instead
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ChangeTimeStampActionDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ChangeTimeStampActionDelegate.java 2011-07-06 08:50:03 UTC (rev 32632)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/ChangeTimeStampActionDelegate.java 2011-07-06 09:16:04 UTC (rev 32633)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Exadel, Inc. and 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,
@@ -11,67 +11,63 @@
package org.jboss.ide.eclipse.as.ui.actions;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-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.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerCore;
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.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
+import org.eclipse.wst.server.ui.internal.view.servers.RestartModuleAction;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
-import org.jboss.ide.eclipse.as.ui.Messages;
public class ChangeTimeStampActionDelegate implements IWorkbenchWindowActionDelegate {
protected IWorkbenchWindow window;
String tooltip = null;
IProject project = null;
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
+ IModule[] module = null;
+ IServer server = null;
+ RestartModuleAction[] restartActions = null;
+ private final static String ESB_PROJECT_FACET = "jst.jboss.esb"; //$NON-NLS-1$
+ private static boolean isESBProject(IProject project) {
+ IFacetedProject facetedProject = null;
+ try {
+ facetedProject = ProjectFacetsManager.create(project);
+ } catch (CoreException e) {
+ JBossServerUIPlugin.log(e.getMessage(), e);
+ return false;
+ }
+ if (facetedProject != null && ProjectFacetsManager.isProjectFacetDefined(ESB_PROJECT_FACET)) {
+ IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(ESB_PROJECT_FACET);
+ return projectFacet != null && facetedProject.hasProjectFacet(projectFacet);
+ }
+ return false;
+}
public void selectionChanged(IAction action, ISelection selection) {
if(project == null && action.isEnabled()) action.setEnabled(false);
if(tooltip != null && (selection instanceof IStructuredSelection)) {
Object o = ((IStructuredSelection)selection).getFirstElement();
- IProject p = getProject(o);
- if(p != null) {
- project = p;
+ setProject(o);
+ setModuleAndServer(o);
+ buildActions();
+ if(project != null) {
action.setEnabled(computeEnabled());
action.setToolTipText(NLS.bind(ServerActionMessages.CHANGE_TIME_STAMP,project.getName()));
return;
@@ -81,279 +77,89 @@
action.setToolTipText(tooltip);
}
- IProject getProject(Object selection) {
+ protected void setProject(Object selection) {
if(selection instanceof IResource) {
- return ((IResource)selection).getProject();
+ project = ((IResource)selection).getProject();
} else if(selection instanceof IAdaptable) {
Object r = ((IAdaptable)selection).getAdapter(IResource.class);
- return r instanceof IResource ? ((IResource)r).getProject() : null;
- }
- return null;
+ project= r instanceof IResource ? ((IResource)r).getProject() : null;
+ } else if( selection instanceof ModuleServer) {
+ project = ((ModuleServer)selection).module[0].getProject();
+ } else
+ project = null;
}
- protected boolean computeEnabled() {
- if(project == null || !project.isAccessible()) return false;
- boolean isWar = JavaEEProjectUtilities.isDynamicWebProject(project);
- boolean isEar = JavaEEProjectUtilities.isEARProject(project);
- boolean isEJB = JavaEEProjectUtilities.isEJBProject(project);
- boolean isEsb = isESBProject(project);
- return isEar || isEJB || isWar || isEsb;
- }
-
- public void run(IAction action) {
- try {
- changeTimeStamp(project);
- } catch (Exception e) {
-
+ void setModuleAndServer(Object selection) {
+ if( selection instanceof IServer ) {
+ server = (IServer)selection;
+ module = null;
+ } else if( selection instanceof ModuleServer ) {
+ server = ((ModuleServer)selection).server;
+ module = ((ModuleServer)selection).module;
}
+ if( project != null ) {
+ IModule tmp = ServerUtil.getModule(project);
+ module = tmp == null ? null : new IModule[]{tmp};
+ }
}
-
- public void dispose() {
- window = null;
- }
- public static void changeTimeStamp(IProject project) throws CoreException {
- if(project == null || !project.isAccessible()) return;
- List<IFile> fs = getFilesToTouch(project);
- for (int i = 0; i < fs.size(); i++) {
- IFile f = (IFile)fs.get(i);
- f.setLocalTimeStamp(System.currentTimeMillis());
- f.touch(new NullProgressMonitor()); // done so deployers/listeners can detect the actual change.
- }
- if(fs.isEmpty() && JavaEEProjectUtilities.isDynamicWebProject(project)) {
- List<IServer> servers = getServers(project);
-
- final IServer[] ss = servers.toArray(new IServer[0]);
-
- final Object input = new Object();
-
- Shell shell = JBossServerUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
- CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(shell, new LabelProvider(), new ITreeContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public void dispose() {
- }
- public boolean hasChildren(Object element) {
- return element == input;
- }
- public Object getParent(Object element) {
- return null;
- }
- public Object[] getElements(Object inputElement) {
- return ss;
- }
- public Object[] getChildren(Object parentElement) {
- return null;
- }
- });
- dialog.setInput(input);
- dialog.setInitialSelections(ss);
- String message = NLS.bind(Messages.ChangeTimestampServerListDialog_Message, project.getName());
- dialog.setMessage(message);
- dialog.create();
- dialog.getShell().setText(Messages.ChangeTimestampServerListDialog_Title);
-
- dialog.open();
- Object[] os = dialog.getResult();
-
- if(os == null || os.length == 0) {
- return;
+ void buildActions() {
+ ArrayList<RestartModuleAction> actionList = new ArrayList<RestartModuleAction>();
+ RestartModuleAction a;
+ if( module != null ) {
+ IServer[] targetServers = null;
+ if( server == null ) {
+ List<IServer> list = getServers(module[0]);
+ targetServers = (IServer[]) list.toArray(new IServer[list.size()]);
+ } else {
+ targetServers = new IServer[]{server};
}
-
- servers.clear();
- for (Object s: os) {
- if(s instanceof IServer) {
- servers.add((IServer)s);
+ for( int i = 0; i < targetServers.length; i++ ) {
+ a = new RestartModuleAction(targetServers[i], module);
+ if( a.isEnabled()) {
+ actionList.add(a);
}
}
-
- new RegisterServerJob(project, servers.toArray(new IServer[0])).schedule();
}
+ restartActions = actionList.toArray(new RestartModuleAction[actionList.size()]);
}
-
- private static List<IFile> getFilesToTouch(IProject project) {
- List<IFile> fs = new ArrayList<IFile>();
- if(project == null || !project.isAccessible()) return fs;
+
+ protected boolean computeEnabled() {
+ if( module == null ) return false;
+ if(project == null || !project.isAccessible()) return false;
boolean isWar = JavaEEProjectUtilities.isDynamicWebProject(project);
boolean isEar = JavaEEProjectUtilities.isEARProject(project);
-
- boolean isReferencedByEar = false;
- if(!isEar) {
- IProject[] ps = J2EEProjectUtilities.getReferencingEARProjects(project);
- for (int i = 0; i < ps.length; i++) {
- fs.addAll(getFilesToTouch(ps[i]));
- isReferencedByEar = true;
- }
- }
- if(isEar) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- IPath path = component.getRootFolder().getProjectRelativePath();
- IFile f = project.getFile(path.append("META-INF").append("application.xml")); //$NON-NLS-1$ //$NON-NLS-2$
- if(f != null && f.exists()) {
- fs.add(f);
- }
- }
- if(isWar && !isReferencedByEar) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- IPath path = component.getRootFolder().getProjectRelativePath();
- IFile f = project.getFile(path.append("WEB-INF").append("web.xml")); //$NON-NLS-1$ //$NON-NLS-2$
- if(f != null && f.exists()) {
- fs.add(f);
- }
- }
- if(isESBProject(project)) {
- IVirtualComponent component = ComponentCore.createComponent(project);
- IPath path = component.getRootFolder().getProjectRelativePath();
- IFile f = project.getFile(path.append("META-INF").append("jboss-esb.xml")); //$NON-NLS-1$ //$NON-NLS-2$
- if(f != null && f.exists()) {
- fs.add(f);
- }
- }
-
- return fs;
+ boolean isEJB = JavaEEProjectUtilities.isEJBProject(project);
+ boolean isEsb = isESBProject(project);
+ boolean canRestart = isEar || isEJB || isWar || isEsb;
+ if( canRestart && restartActions != null && restartActions.length > 0 )
+ return true;
+ return false;
}
- private final static String ESB_PROJECT_FACET = "jst.jboss.esb"; //$NON-NLS-1$
-
- private static boolean isESBProject(IProject project) {
- IFacetedProject facetedProject = null;
- try {
- facetedProject = ProjectFacetsManager.create(project);
- } catch (CoreException e) {
- JBossServerUIPlugin.log(e.getMessage(), e);
- return false;
+ public void run(IAction action) {
+ for( int i = 0; i < restartActions.length; i++ ) {
+ restartActions[i].run();
}
- if (facetedProject != null && ProjectFacetsManager.isProjectFacetDefined(ESB_PROJECT_FACET)) {
- IProjectFacet projectFacet = ProjectFacetsManager.getProjectFacet(ESB_PROJECT_FACET);
- return projectFacet != null && facetedProject.hasProjectFacet(projectFacet);
- }
- return false;
}
- static List<IServer> getServers(IProject project) {
+ static List<IServer> getServers(IModule module) {
List<IServer> result = new ArrayList<IServer>();
IServer[] servers = ServerCore.getServers();
for (IServer s: servers) {
- if(isRegistered(project, s)) {
- result.add(s);
+ IModule[] modules = s.getModules();
+ for( int j = 0; j < modules.length; j++ ) {
+ if( modules[j].equals(module))
+ result.add(s);
}
}
return result;
}
-
- public static boolean isRegistered(IProject project, IServer server) {
- if(server == null || project == null) return false;
- IModule[] ms = server.getModules();
- IModule m = findModule(project);
- return (contains(ms, m));
- }
- public static IModule findModule(IProject project) {
- // https://jira.jboss.org/jira/browse/JBIDE-3972
- // There may be a few modules for resources from the same project.
- // Ignore module with jboss.singlefile type if there are other module types.
- IModule[] modules = ServerUtil.getModules(project);
- if(modules != null && modules.length>0) {
- for (int i = 0; i < modules.length; i++) {
- if(!"jboss.singlefile".equals(modules[i].getModuleType().getId())) { //$NON-NLS-1$
- return modules[i];
- }
- }
- }
- return null;
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
}
-
- private static boolean contains(IModule[] modules, IModule module) {
- if(modules == null || module == null) return false;
- for (int i = 0; i < modules.length; i++) {
- if(modules[i].getName() != null && modules[i].getName().equals(module.getName())) return true;
- }
- return false;
+ public void dispose() {
+ window = null;
}
-
- public static void register(IProject project, IServer server) {
- if(server == null) return;
- IModule m = findModule(project);
- if(m == null) return;
- if(contains(server.getModules(), m)) return;
- IModule[] add = new IModule[]{m};
- IModule[] remove = new IModule[0];
- try {
- IProgressMonitor monitor = new NullProgressMonitor();
- IServerWorkingCopy copy = server.createWorkingCopy();
- IStatus status = copy.canModifyModules(add, remove, monitor);
- if(status != null && !status.isOK()) return;
- ServerUtil.modifyModules(copy, add, remove, monitor);
- copy.save(true, monitor);
- if(canPublish(server)) {
- server.publish(IServer.PUBLISH_INCREMENTAL, monitor);
- }
- } catch (CoreException e) {
-// WebModelPlugin.getPluginLog().logError(e);
- }
- }
-
- public static boolean canPublish(IServer server) {
- if(server == null || server.getRuntime() == null) return false;
- if (((ServerType)server.getServerType()).startBeforePublish() &&
- (server.getServerState() != IServer.STATE_STARTED)) {
- return false;
- }
- return true;
- }
-
- public static boolean unregister(IProject project, IServer server) {
- if(server == null) return false;
- IModule m = findModule(project);
- if(!contains(server.getModules(), m)) return false;
- IModule[] add = new IModule[0];
- IModule[] remove = new IModule[]{m};
- try {
- IProgressMonitor monitor = new NullProgressMonitor();
- IServerWorkingCopy copy = server.createWorkingCopy();
- ServerUtil.modifyModules(copy, add, remove, monitor);
- copy.save(true, monitor);
- if(canPublish(server)) {
- server.publish(IServer.PUBLISH_INCREMENTAL, monitor);
- }
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID,MessageFormat.format(ServerActionMessages.ChangeTimeStampActionDelegate_cannot_unregister, server.getName(), project.getName()), e);
- JBossServerUIPlugin.getDefault().getLog().log(status);
- }
- return true;
- }
-
- private static class RegisterServerJob extends Job {
- long counter = 100;
- IProject project;
- IServer[] servers;
- public RegisterServerJob(IProject p, IServer[] servers) {
- super("Touch"); //$NON-NLS-1$
- this.project = p;
- this.servers = servers;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- try {
- ResourcesPlugin.getWorkspace().run(new WR(), monitor);
- } catch (CoreException e) {
- IStatus status = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, MessageFormat.format(ServerActionMessages.ChangeTimeStampActionDelegate_could_not_register_project, project.getName()), e);
- JBossServerUIPlugin.getDefault().getLog().log(status);
- }
- return Status.OK_STATUS;
- }
-
- class WR implements IWorkspaceRunnable {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (IServer s: servers) {
- unregister(project, s);
- }
- for (IServer s: servers) {
- register(project, s);
- }
- }
-
- }
- }
-
}
\ No newline at end of file
13 years, 6 months
JBoss Tools SVN: r32632 - trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-07-06 04:50:03 -0400 (Wed, 06 Jul 2011)
New Revision: 32632
Removed:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/ColorManager.java
Log:
remove unused ColorManager class
Deleted: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/ColorManager.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/ColorManager.java 2011-07-06 08:01:27 UTC (rev 32631)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/console/ColorManager.java 2011-07-06 08:50:03 UTC (rev 32632)
@@ -1,43 +0,0 @@
-package org.jboss.tools.forge.console;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-class ColorManager {
-
- private static ColorManager INSTANCE;
-
- private ColorManager() {}
-
- public static ColorManager getInstance() {
- if (INSTANCE == null) {
- INSTANCE= new ColorManager();
- }
- return INSTANCE;
- }
-
- protected Map<RGB, Color> fColorTable= new HashMap<RGB, Color>(10);
-
- public Color getColor(RGB rgb) {
- Color color= (Color) fColorTable.get(rgb);
- if (color == null) {
- color= new Color(Display.getCurrent(), rgb);
- fColorTable.put(rgb, color);
- }
- return color;
- }
-
- public void dispose() {
- Iterator<Color> e= fColorTable.values().iterator();
- while (e.hasNext())
- ((Color) e.next()).dispose();
- }
-}
-
-
13 years, 6 months
JBoss Tools SVN: r32631 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal: v7 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-07-06 04:01:27 -0400 (Wed, 06 Jul 2011)
New Revision: 32631
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
Log:
JBIDE-9274 - implementing "restart" on the module level for as7
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 04:43:54 UTC (rev 32630)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-06 08:01:27 UTC (rev 32631)
@@ -179,9 +179,8 @@
getOrCreatePublishMethod().getCallbackHandler(depPath.removeLastSegments(1), getServer()).touchResource(new Path(depPath.lastSegment()));
} else {
// touch the descriptor
- IPath deployPath = PublishUtil.getDeployPath(method, module, ds);
- IPublishCopyCallbackHandler callback = method.getCallbackHandler(AbstractServerToolsPublisher.getRootPath(deployPath).append(deployPath), getServer());
- JSTPublisherXMLToucher.getInstance().touch(deployPath, module[0], callback);
+ IPublishCopyCallbackHandler callback = method.getCallbackHandler(AbstractServerToolsPublisher.getRootPath(depPath).append(depPath), getServer());
+ JSTPublisherXMLToucher.getInstance().touch(depPath, module[0], callback);
}
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-06 04:43:54 UTC (rev 32630)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-06 08:01:27 UTC (rev 32631)
@@ -12,6 +12,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -20,6 +21,7 @@
import org.eclipse.core.runtime.IPath;
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.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.DebugEvent;
@@ -28,16 +30,24 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
+import org.jboss.ide.eclipse.as.core.publishers.AbstractServerToolsPublisher;
+import org.jboss.ide.eclipse.as.core.publishers.JSTPublisherXMLToucher;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
public class JBoss7ServerBehavior extends JBossServerBehavior {
@@ -93,19 +103,7 @@
@Override
protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor monitor)
throws CoreException {
-/* fix for JBIDE-
-* if (method == null)
-* throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Not publishing")); //$NON-NLS-1$
-* try {
-* int result = method.publishModule(this, kind, deltaKind, module, monitor);
-* setModulePublishState(module, result);
-* } catch(CoreException e) {
-* setModulePublishState(module, IServer.PUBLISH_STATE_FULL);
-* throw e;
-* }
-*/
- int result = getOrCreatePublishMethod().publishModule(this, kind, deltaKind, module, monitor);
- setModulePublishState(module, result);
+ super.publishModule(kind, deltaKind, module, monitor);
}
@Override
@@ -123,7 +121,18 @@
monitor.beginTask("Completing Publishes", paths.size() + 1); //$NON-NLS-1$
createDoDeployMarker(paths, monitor);
}
+
+ public void restartModule(IModule[] module, IProgressMonitor monitor) throws CoreException {
+ IDeployableServer ds = ServerConverter.getDeployableServer(getServer());
+ if( ds == null )
+ return;
+ IJBossServerPublishMethod method = getOrCreatePublishMethod();
+ IPath depPath = PublishUtil.getDeployPath(method, module, ds);
+ createDoDeployMarker(new IPath[]{depPath}, monitor);
+ }
+
+
protected IJBoss7ManagerService getService() throws Exception {
if (service == null) {
service = JBoss7ManagerUtil.getService(getServer());
@@ -230,9 +239,11 @@
}
return (List<IPath>) o;
}
-
+ private void createDoDeployMarker(IPath[] paths, IProgressMonitor monitor) throws CoreException {
+ List<IPath> allPaths = Arrays.asList(paths);
+ createDoDeployMarker(allPaths, monitor);
+ }
private void createDoDeployMarker(List<IPath> paths, IProgressMonitor monitor) throws CoreException {
DeploymentMarkerUtils.addDoDeployMarker(getOrCreatePublishMethod(), getServer(), paths, monitor);
}
-
}
13 years, 6 months