JBoss Tools SVN: r12199 - trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-01 21:43:30 -0500 (Mon, 01 Dec 2008)
New Revision: 12199
Added:
trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/.project
trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/build.properties
trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml
Log:
initial import
Added: trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/.project
===================================================================
--- trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/.project (rev 0)
+++ trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/.project 2008-12-02 02:43:30 UTC (rev 12199)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.jpdl4.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/build.properties
===================================================================
--- trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/build.properties (rev 0)
+++ trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/build.properties 2008-12-02 02:43:30 UTC (rev 12199)
@@ -0,0 +1 @@
+bin.includes = feature.xml
Added: trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml
===================================================================
--- trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml (rev 0)
+++ trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/feature.xml 2008-12-02 02:43:30 UTC (rev 12199)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.flow.jpdl4.feature"
+ label="jPDL4 Feature"
+ version="1.0.0"
+ provider-name="JBoss, a Division of Red Hat">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <plugin
+ id="org.jboss.tools.flow.jpdl4"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
17 years
JBoss Tools SVN: r12198 - trunk/jbpm/features.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-01 21:42:48 -0500 (Mon, 01 Dec 2008)
New Revision: 12198
Added:
trunk/jbpm/features/org.jboss.tools.flow.jpdl4.feature/
Log:
Initial import.
17 years
JBoss Tools SVN: r12197 - in trunk/flow/plugins/org.jboss.tools.flow.common: src/org/jboss/tools/flow/common/figure and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-01 21:42:00 -0500 (Mon, 01 Dec 2008)
New Revision: 12197
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/build.properties
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/AbstractElementFigure.java
Log:
icons should be part of the build
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/build.properties
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/build.properties 2008-12-02 02:38:43 UTC (rev 12196)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/build.properties 2008-12-02 02:42:00 UTC (rev 12197)
@@ -5,5 +5,6 @@
META-INF/
bin.includes = .,\
META-INF/,\
- plugin.xml
+ plugin.xml,\
+ icons/
output.. = bin/
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/AbstractElementFigure.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/AbstractElementFigure.java 2008-12-02 02:38:43 UTC (rev 12196)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/figure/AbstractElementFigure.java 2008-12-02 02:42:00 UTC (rev 12197)
@@ -18,9 +18,11 @@
import org.eclipse.draw2d.ChopboxAnchor;
import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Panel;
import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
@@ -82,4 +84,11 @@
return new ChopboxAnchor(this);
}
+ public void paint(Graphics g) {
+ int saved = g.getAntialias();
+ g.setAntialias(SWT.ON);
+ super.paint(g);
+ g.setAntialias(saved);
+ }
+
}
17 years
JBoss Tools SVN: r12196 - trunk/flow/features/org.jboss.tools.flow.common.feature.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-01 21:38:43 -0500 (Mon, 01 Dec 2008)
New Revision: 12196
Added:
trunk/flow/features/org.jboss.tools.flow.common.feature/.project
trunk/flow/features/org.jboss.tools.flow.common.feature/build.properties
trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml
Log:
initial import
Added: trunk/flow/features/org.jboss.tools.flow.common.feature/.project
===================================================================
--- trunk/flow/features/org.jboss.tools.flow.common.feature/.project (rev 0)
+++ trunk/flow/features/org.jboss.tools.flow.common.feature/.project 2008-12-02 02:38:43 UTC (rev 12196)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.common.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/flow/features/org.jboss.tools.flow.common.feature/build.properties
===================================================================
--- trunk/flow/features/org.jboss.tools.flow.common.feature/build.properties (rev 0)
+++ trunk/flow/features/org.jboss.tools.flow.common.feature/build.properties 2008-12-02 02:38:43 UTC (rev 12196)
@@ -0,0 +1 @@
+bin.includes = feature.xml
Added: trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml
===================================================================
--- trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml (rev 0)
+++ trunk/flow/features/org.jboss.tools.flow.common.feature/feature.xml 2008-12-02 02:38:43 UTC (rev 12196)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.flow.common.feature"
+ label="Flow Common Feature"
+ version="1.0.0"
+ provider-name="JBoss, a Division of Red Hat">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <plugin
+ id="org.jboss.tools.flow.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
17 years
JBoss Tools SVN: r12194 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2008-12-01 21:33:11 -0500 (Mon, 01 Dec 2008)
New Revision: 12194
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizard.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
Log:
added new file wizard
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2008-12-02 02:19:45 UTC (rev 12193)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/META-INF/MANIFEST.MF 2008-12-02 02:33:11 UTC (rev 12194)
@@ -6,10 +6,11 @@
Bundle-Vendor: JBoss, a Division of Red Hat
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.jboss.tools.flow.common;bundle-version="1.0.0",
- org.eclipse.core.resources;bundle-version="3.4.0",
- org.eclipse.gef;bundle-version="3.4.0",
- org.eclipse.ui;bundle-version="3.4.0",
- org.eclipse.core.runtime;bundle-version="3.4.0"
+ org.eclipse.core.resources;bundle-version="3.4.1",
+ org.eclipse.gef;bundle-version="3.4.1",
+ org.eclipse.ui;bundle-version="3.4.1",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui.ide;bundle-version="3.4.1"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.flow.jpdl4.Activator
Export-Package: org.jboss.tools.flow.jpdl4.model
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties 2008-12-02 02:19:45 UTC (rev 12193)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/build.properties 2008-12-02 02:33:11 UTC (rev 12194)
@@ -2,4 +2,5 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.xml
+ plugin.xml,\
+ icons/
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-12-02 02:19:45 UTC (rev 12193)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2008-12-02 02:33:11 UTC (rev 12194)
@@ -2,14 +2,33 @@
<?eclipse version="3.2"?>
<plugin>
+ <extension
+ point="org.eclipse.core.contenttype.contentTypes">
+ <content-type
+ base-type="org.eclipse.core.runtime.xml"
+ file-extensions="xml"
+ id="org.jboss.tools.flow.jpdl4"
+ name="jPDL 4 File"
+ priority="normal">
+ <describer
+ class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
+ <parameter
+ name="element"
+ value="process">
+ </parameter>
+ </describer>
+ </content-type>
+ </extension>
<extension point="org.eclipse.ui.editors">
<editor
name="jPDL4 Editor"
- extensions="jpdl4"
icon="icons/process.gif"
contributorClass="org.jboss.tools.flow.common.editor.GenericActionBarContributor"
class="org.jboss.tools.flow.jpdl4.editor.JpdlEditor"
id="org.jboss.tools.flow.jpdl4.editor">
+ <contentTypeBinding
+ contentTypeId="org.jboss.tools.flow.jpdl4">
+ </contentTypeBinding>
</editor>
</extension>
<extension
@@ -82,5 +101,18 @@
<connection></connection>
</element>
</extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.flow.jpdl4"
+ name="jBPM">
+ </category>
+ <wizard
+ class="org.jboss.tools.flow.jpdl4.wizard.NewJpdl4FileWizard"
+ icon="icons/process.gif"
+ id="org.jboss.tools.flow.jpdl4.file"
+ name="jPDL4 File">
+ </wizard>
+ </extension>
</plugin>
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2008-12-02 02:19:45 UTC (rev 12193)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2008-12-02 02:33:11 UTC (rev 12194)
@@ -33,7 +33,13 @@
}
protected void createModel(InputStream is) {
- setModel(JpdlDeserializer.deserialize(is));
+ boolean empty = true;
+ try {
+ empty = is.available() == 0;
+ } catch (IOException e) {
+ // ignored
+ }
+ setModel(empty ? createModel() : JpdlDeserializer.deserialize(is));
}
}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizard.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizard.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizard.java 2008-12-02 02:33:11 UTC (rev 12194)
@@ -0,0 +1,37 @@
+package org.jboss.tools.flow.jpdl4.wizard;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWizard;
+
+public class NewJpdl4FileWizard extends Wizard implements IWorkbenchWizard {
+
+ private IStructuredSelection selection;
+ private NewJpdl4FileWizardPage newFileWizardPage;
+
+ public NewJpdl4FileWizard() {
+ setWindowTitle("New jPDL4 File");
+ }
+
+ @Override
+ public void addPages() {
+ newFileWizardPage = new NewJpdl4FileWizardPage(selection);
+ addPage(newFileWizardPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ IFile file = newFileWizardPage.createNewFile();
+ if (file != null)
+ return true;
+ else
+ return false;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+}
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/wizard/NewJpdl4FileWizardPage.java 2008-12-02 02:33:11 UTC (rev 12194)
@@ -0,0 +1,22 @@
+package org.jboss.tools.flow.jpdl4.wizard;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+public class NewJpdl4FileWizardPage extends WizardNewFileCreationPage {
+
+ public NewJpdl4FileWizardPage(IStructuredSelection selection) {
+ super("NewJpdl4FileWizardPage", selection);
+ setTitle("Jpdl4 File");
+ setDescription("Creates a new jpdl4 File");
+ setFileExtension("jpdl.xml");
+ }
+
+ @Override
+ protected InputStream getInitialContents() {
+ return new ByteArrayInputStream("<process>\n</process>".getBytes());
+ }
+}
17 years
JBoss Tools SVN: r12193 - 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: rob.stryker(a)jboss.com
Date: 2008-12-01 21:19:45 -0500 (Mon, 01 Dec 2008)
New Revision: 12193
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
Log:
JBIDE-3307 - removed segments instead of chopped off the device as well.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2008-12-02 02:02:41 UTC (rev 12192)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2008-12-02 02:19:45 UTC (rev 12193)
@@ -156,8 +156,10 @@
public static IPath makeRelative(IJBossServerRuntime rt, IPath p) {
if( p.isAbsolute()) {
- if(rt.getRuntime().getLocation().isPrefixOf(p))
- return p.removeFirstSegments(rt.getRuntime().getLocation().segmentCount()).makeRelative();
+ if(rt.getRuntime().getLocation().isPrefixOf(p)) {
+ int size = rt.getRuntime().getLocation().toOSString().length();
+ return new Path(p.toOSString().substring(size)).makeRelative();
+ }
}
return p;
}
17 years
JBoss Tools SVN: r12192 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-01 21:02:41 -0500 (Mon, 01 Dec 2008)
New Revision: 12192
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/AbstractEntry.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/Group.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogEntry.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogLabelProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogReader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogSession.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLogger.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
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/PollThread.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java
Log:
JBIDE-3273 - event log regressions
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/IEventCodes.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,48 @@
+package org.jboss.ide.eclipse.as.core.extensions.events;
+
+
+public interface IEventCodes {
+ public static final int MAJOR_TYPE_MASK = 0xFF << 24;
+ public static final int POLLING_CODE = 1 << 24;
+ public static final int PUBLISHING_CODE = 2 << 24;
+ public static final int POLLER_MASK = 0xFF << 16;
+ public static final int PUBLISHER_MASK = 0xFF << 16;
+ public static final int FULL_POLLER_MASK = MAJOR_TYPE_MASK | POLLER_MASK;
+ public static final int FULL_PUBLISHER_MASK = MAJOR_TYPE_MASK | PUBLISHER_MASK;
+
+ /* Polling */
+ public static final int POLLING_ROOT_CODE = POLLING_CODE | (1 << 16);
+ public static final int JMXPOLLER_CODE = POLLING_CODE | (2 << 16);
+ public static final int BEHAVIOR_STATE_CODE = POLLING_CODE | (3 << 16);
+
+ // Polling.Behavior Codes
+ public static final int BEHAVIOR_PROCESS_TERMINATED = BEHAVIOR_STATE_CODE | 1;
+ public static final int BEHAVIOR_FORCE_STOP = BEHAVIOR_STATE_CODE | 2;
+ public static final int BEHAVIOR_FORCE_STOP_FAILED = BEHAVIOR_STATE_CODE | 3;
+
+ // Publishing
+ public static final int PUBLISHING_ROOT_CODE = PUBLISHING_CODE | (1 << 16);
+ public static final int JST_PUBLISHER_CODE = PUBLISHING_CODE | (2 << 16);
+ public static final int SINGLE_FILE_PUBLISHER_CODE = PUBLISHING_CODE | (3 << 16);
+
+ // Publishing.JST
+ public static final int JST_PUB_FULL_SUCCESS = JST_PUBLISHER_CODE | 1;
+ public static final int JST_PUB_FULL_FAIL = JST_PUBLISHER_CODE | 2;
+ public static final int JST_PUB_INC_SUCCESS = JST_PUBLISHER_CODE | 3;
+ public static final int JST_PUB_INC_FAIL = JST_PUBLISHER_CODE | 4;
+ public static final int JST_PUB_REMOVE_SUCCESS = JST_PUBLISHER_CODE | 5;
+ public static final int JST_PUB_REMOVE_FAIL = JST_PUBLISHER_CODE | 6;
+ public static final int JST_PUB_COPY_BINARY_FAIL = JST_PUBLISHER_CODE | 7;
+ public static final int JST_PUB_FILE_DELETE_FAIL = JST_PUBLISHER_CODE | 8;
+ public static final int JST_PUB_ASSEMBLE_FAIL = JST_PUBLISHER_CODE | 9;
+
+ // Publishing.single
+ public static final int SINGLE_FILE_SUCCESS_MASK = 0x1;
+ public static final int SINGLE_FILE_TYPE_MASK = 0x2;
+ public static final int SINGLE_FILE_PUBLISH_FAIL = SINGLE_FILE_PUBLISHER_CODE | 0;
+ public static final int SINGLE_FILE_PUBLISH_SUCCESS = SINGLE_FILE_PUBLISHER_CODE | 1;
+ public static final int SINGLE_FILE_UNPUBLISH_FAIL = SINGLE_FILE_PUBLISHER_CODE | 2;
+ public static final int SINGLE_FILE_UNPUBLISH_SUCCESS = SINGLE_FILE_PUBLISHER_CODE | 3;
+ public static final int SINGLE_FILE_PUBLISH_MNF = SINGLE_FILE_PUBLISH_FAIL | 16;
+ public static final int SINGLE_FILE_UNPUBLISH_MNF = SINGLE_FILE_UNPUBLISH_FAIL | 16;
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLog.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -17,7 +17,7 @@
log(getLog(status));
}
- // Hard Coppied from PlatformLogWriter. You'd think
+ // Hard Copied from PlatformLogWriter. You'd think
// they'd make that method static or some shit.
protected FrameworkLogEntry getLog(IStatus status) {
Throwable t = status.getException();
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLogger.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLogger.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/events/ServerLogger.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -31,7 +31,6 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
public class ServerLogger implements IJBossServerConstants {
- public static final int MAJOR_TYPE_MASK = 0x11111111 << 24;
private static ServerLogger instance;
public static ServerLogger getDefault() {
if( instance == null ) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -35,6 +35,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+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.extensions.jmx.JMXClassLoaderRepository;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXSafeRunner;
@@ -51,9 +52,7 @@
public class JMXPoller implements IServerStatePoller {
public static final String POLLER_ID = "org.jboss.ide.eclipse.as.core.runtime.server.JMXPoller";
-
- public static final int CODE = 2 << 16;
- public static final int JMXPOLLER_CODE = POLLING_CODE | CODE;
+ public static final int JMXPOLLER_CODE = IEventCodes.JMXPOLLER_CODE;
public static final String REQUIRED_USER = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.REQUIRED_USER";
public static final String REQUIRED_PASS = "org.jboss.ide.eclipse.as.core.extensions.polling.jmx.REQUIRED_PASS";
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -48,6 +48,7 @@
import org.eclipse.wst.server.core.model.ModuleDelegate;
import org.eclipse.wst.server.core.util.ProjectModule;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
@@ -130,7 +131,8 @@
list.addAll(Arrays.asList(packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath)));
if( list.size() > 0 ) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IStatus.ERROR, "Full Publish Failed for module " + module.getName(), null);
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_FAIL,
+ "Full Publish Failed for module " + module.getName(), null);
for( int i = 0; i < list.size(); i++ )
ms.add(list.get(i));
return ms;
@@ -148,7 +150,8 @@
FileUtil.touch(filter, deployPath.toFile(), true);
publishState = IServer.PUBLISH_STATE_NONE;
- IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, countMembers(module) + " files modified in module " + module.getName(), null);
+ IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS,
+ countMembers(module) + " files modified in module " + module.getName(), null);
return ret;
}
@@ -164,27 +167,32 @@
results = packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath);
}
if( results != null && results.length > 0 ) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IStatus.ERROR, "Incremental Publish Failed for module " + module.getName(), null);
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_INC_FAIL,
+ "Incremental Publish Failed for module " + module.getName(), null);
for( int i = 0; i < results.length; i++ )
ms.add(results[i]);
return ms;
}
- IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, countChanges(delta) + " files modified in module " + module.getName(), null);
+ IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FULL_SUCCESS,
+ countChanges(delta) + " files modified in module " + module.getName(), null);
return ret;
}
protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
+ IModule mod = module[module.length-1];
IStatus[] errors = localSafeDelete(getDeployPath(module));
if( errors.length > 0 ) {
- IModule mod = module[module.length-1];
publishState = IServer.PUBLISH_STATE_FULL;
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to delete module " + mod.getName(), new Exception("Some files were not removed from the server"));
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_REMOVE_FAIL,
+ "Unable to delete module " + mod.getName(), new Exception("Some files were not removed from the server"));
for( int i = 0; i < errors.length; i++ )
ms.addAll(errors[i]);
throw new CoreException(ms);
}
- return null;
+ IStatus ret = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_REMOVE_SUCCESS,
+ mod.getName() + " removed.", null);
+ return ret;
}
protected IPath getDeployPath(IModule[] moduleTree) {
@@ -239,12 +247,12 @@
FileUtil.fileSafeCopy(source, deployPath.toFile(), listener);
return listener.getStatuses();
} else {
- IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- "Could not publish module " + moduleTree[moduleTree.length-1]);
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_COPY_BINARY_FAIL,
+ "Could not publish module " + moduleTree[moduleTree.length-1], null);
return new IStatus[] {s};
}
} catch( CoreException ce ) {
- IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ IStatus s = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_COPY_BINARY_FAIL,
"Could not publish module " + moduleTree[moduleTree.length-1], ce);
return new IStatus[] {s};
}
@@ -260,15 +268,17 @@
Assert.isTrue(!deployPath.toFile().equals(new Path(serverDeployFolder).toFile()), "An attempt to delete your entire deploy folder has been prevented. This should never happen");
final ArrayList<IStatus> status = new ArrayList<IStatus>();
IFileUtilListener listener = new IFileUtilListener() {
- public void fileCoppied(File source, File dest, boolean result,Exception e) {}
+ public void fileCopied(File source, File dest, boolean result,Exception e) {}
public void fileDeleted(File file, boolean result, Exception e) {
if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Attempt to delete " + file.getAbsolutePath() + " failed",e));
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e));
}
}
public void folderDeleted(File file, boolean result, Exception e) {
if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Attempt to delete " + file.getAbsolutePath() + " failed",e));
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e));
}
}
};
@@ -299,8 +309,8 @@
doPackModule(resources[i], packager);
}
} catch (IOException e) {
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, 0,
- "unable to assemble module", e); //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_ASSEMBLE_FAIL,
+ "unable to assemble module " + module.getName(), e); //$NON-NLS-1$
return new IStatus[]{status};
}
finally{
@@ -308,8 +318,8 @@
packager.finished();
}
catch(IOException e){
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, 0,
- "unable to assemble module", e); //$NON-NLS-1$
+ IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_ASSEMBLE_FAIL,
+ "unable to assemble module "+ module.getName(), e); //$NON-NLS-1$
return new IStatus[]{status};
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -24,9 +24,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
/**
@@ -44,6 +46,6 @@
public IStatus publishModule(IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws CoreException {
- return null;
+ return new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, "No publisher found for module " + module[module.length-1]);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -14,6 +14,7 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
@@ -76,16 +77,19 @@
if( l.errorFound || !success ) {
publishState = IServer.PUBLISH_STATE_FULL;
Exception e = l.e != null ? l.e : new Exception("Move from " + tempDestFile + " to " + destFile + " failed.");
- return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "The module cannot be published.", e);
+ return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_PUBLISH_FAIL,
+ "The module cannot be published.", e);
}
} else {
// deleted module. o noes. Ignore it. We can't re-publish it, so just ignore it.
publishState = IServer.PUBLISH_STATE_UNKNOWN;
- Status status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, "The module cannot be published because it cannot be located. (" + module.getName() + ")");
+ Status status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_PUBLISH_MNF,
+ "The module cannot be published because it cannot be located. (" + module.getName() + ")", null);
return status;
}
- Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, "Module " + module.getName() + " coppied.");
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
+ IEventCodes.SINGLE_FILE_PUBLISH_SUCCESS, "Module " + module.getName() + " copied.", null);
return status;
}
@@ -100,17 +104,25 @@
FileUtil.safeDelete(destFile, l);
if( l.errorFound ) {
publishState = IServer.PUBLISH_STATE_FULL;
- return new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, "Unable to delete module " + module.getName() + " from server.", l.e);
+ return new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_FAIL,
+ "Unable to delete module " + module.getName() + " from server.", l.e);
}
+ } else {
+ // deleted module. o noes. Ignore it.
+ publishState = IServer.PUBLISH_STATE_UNKNOWN;
+ Status status = new Status(IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_MNF,
+ "The module cannot be removed because it cannot be located. (" + module.getName() + ")", null);
+ return status;
}
- Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, "Module " + module.getName() + " removed.");
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID, IEventCodes.SINGLE_FILE_UNPUBLISH_SUCCESS,
+ "Module " + module.getName() + " removed.", null);
return status;
}
public static class FileUtilListener implements IFileUtilListener {
protected boolean errorFound = false;
protected Exception e;
- public void fileCoppied(File source, File dest, boolean result,Exception e) {
+ public void fileCopied(File source, File dest, boolean result,Exception e) {
if( result == false || e != null ) {
errorFound = true;
this.e = e;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -38,7 +38,6 @@
public static final int INCREMENTAL_PUBLISH = 1;
public static final int FULL_PUBLISH = 2;
public static final int REMOVE_PUBLISH = 3;
- public static final int POLLING_CODE = 1 << 24;
// pre-publish
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -25,6 +25,7 @@
import java.util.Properties;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
@@ -34,8 +35,9 @@
*
*/
public interface IServerStatePoller {
- public static final int POLLING_CODE = 1 << 24;
-
+ public static final int POLLING_CODE = IEventCodes.POLLING_CODE;
+ public static final int POLLER_MASK = IEventCodes.POLLER_MASK;
+
public static final boolean SERVER_UP = true;
public static final boolean SERVER_DOWN = false;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -24,7 +24,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
@@ -32,7 +31,6 @@
import org.eclipse.wst.server.core.ServerEvent;
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.internal.launch.DeployableLaunchConfiguration;
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 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -36,6 +36,7 @@
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+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.extensions.jmx.JBossServerConnectionProvider;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
@@ -108,20 +109,20 @@
protected void addForceStopFailedEvent(DebugException e) {
IStatus status = new Status(IStatus.ERROR,
- JBossServerCorePlugin.PLUGIN_ID, 0,
+ JBossServerCorePlugin.PLUGIN_ID, IEventCodes.BEHAVIOR_FORCE_STOP_FAILED,
FORCE_TERMINATE_FAILED, e);
ServerLogger.getDefault().log(getServer(), status);
}
protected void addForceStopEvent() {
IStatus status = new Status(IStatus.ERROR,
- JBossServerCorePlugin.PLUGIN_ID, 0,
+ JBossServerCorePlugin.PLUGIN_ID, IEventCodes.BEHAVIOR_FORCE_STOP,
FORCE_TERMINATED, null);
ServerLogger.getDefault().log(getServer(), status);
}
protected void addProcessTerminatedEvent() {
IStatus status = new Status(IStatus.INFO,
- JBossServerCorePlugin.PLUGIN_ID, 0,
+ JBossServerCorePlugin.PLUGIN_ID, IEventCodes.BEHAVIOR_PROCESS_TERMINATED,
TERMINATED, null);
ServerLogger.getDefault().log(getServer(), status);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -28,6 +28,7 @@
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+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.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IPollerFailureHandler;
@@ -44,11 +45,11 @@
// PollThread status objects look like this:
// 00000001xxxxxxxxaaaaaaaaaaaaaaaa
// 00000001000000010000000000xxx00x
- public static final int POLLING_ROOT_CODE = IServerStatePoller.POLLING_CODE | 1 << 16;
+ public static final int POLLING_ROOT_CODE = IEventCodes.POLLING_ROOT_CODE;
public static final int SUCCESS = 0x1;
public static final int FAIL = 0;
public static final int POLLING_FAIL_CODE = POLLING_ROOT_CODE | FAIL;
- public static final int STATE_MASK = 0x111000;
+ public static final int STATE_MASK = 0x38; // 0b111000;
public static final int STATE_UNKNOWN = IServer.STATE_UNKNOWN << 3;
public static final int STATE_STARTING = IServer.STATE_STARTING << 3;
public static final int STATE_STARTED = IServer.STATE_STARTED << 3;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -37,7 +37,7 @@
public static interface IFileUtilListener {
public void fileDeleted(File file, boolean result, Exception e);
public void folderDeleted(File file, boolean result, Exception e);
- public void fileCoppied(File source, File dest, boolean result, Exception e);
+ public void fileCopied(File source, File dest, boolean result, Exception e);
}
@@ -126,10 +126,10 @@
}
fis.close();
fos.close();
- if( listener != null ) listener.fileCoppied(src, dest, true, null);
+ if( listener != null ) listener.fileCopied(src, dest, true, null);
return true;
} catch( Exception e ) {
- if( listener != null ) listener.fileCoppied(src, dest, false, e);
+ if( listener != null ) listener.fileCopied(src, dest, false, e);
return false;
}
}
@@ -150,7 +150,7 @@
public static class FileUtilListener implements IFileUtilListener {
protected ArrayList<IStatus> errors = new ArrayList<IStatus>();
- public void fileCoppied(File source, File dest, boolean result,
+ public void fileCopied(File source, File dest, boolean result,
Exception e) {
if(!result)
errors.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, "Error copying file " + source.toString() + " to " + dest.toString(), e));
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -69,6 +69,7 @@
IDecoratorManager manager = WorkbenchPlugin.getDefault().getDecoratorManager();
manager.setEnabled("org.jboss.tools.as.wst.server.ui.navigatorDecorator", true);
manager.setEnabled("org.jboss.ide.eclipse.as.ui.extensions.xml.decorator", true);
+ manager.setEnabled("org.jboss.ide.eclipse.as.ui.views.ServerLogView.decorator", true);
prefs.setValue(IPreferenceKeys.ENABLED_DECORATORS, true);
savePluginPreferences();
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/AbstractEntry.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/AbstractEntry.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/AbstractEntry.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,106 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+public abstract class AbstractEntry extends PlatformObject implements IWorkbenchAdapter {
+
+ /**
+ * The collection of direct children of this entry
+ */
+ private List children = new ArrayList();
+ protected Object parent;
+
+ /**
+ * Adds the specified child entry to the listing of children.
+ * If the specified child is <code>null</code>, no work is done
+ *
+ * @param child
+ */
+ public void addChild(AbstractEntry child) {
+ if (child != null) {
+ children.add(0, child);
+ child.setParent(this);
+ }
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getChildren(Object)
+ */
+ public Object[] getChildren(Object parent) {
+ return children.toArray();
+ }
+
+ /**
+ * @return true if this entry has children, false otherwise
+ */
+ public boolean hasChildren() {
+ return children.size() > 0;
+ }
+
+ /**
+ * @return the size of the child array
+ *
+ * TODO rename to getChildCount(), or something more meaningful
+ */
+ public int size() {
+ return children.size();
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getImageDescriptor(Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object object) {
+ return null;
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getLabel(Object)
+ */
+ public String getLabel(Object o) {
+ return null;
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getParent(Object)
+ */
+ public Object getParent(Object o) {
+ return parent;
+ }
+
+ /**
+ * Sets the parent of this entry
+ * @param parent
+ */
+ public void setParent(AbstractEntry parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * removes all of the children specified in the given listing
+ *
+ * @param list the list of children to remove
+ */
+ public void removeChildren(List list) {
+ children.removeAll(list);
+ }
+
+ /**
+ * Removes all of the children from this entry
+ */
+ public void removeAllChildren() {
+ children.clear();
+ }
+
+ /**
+ * Writes this entry information into the given {@link PrintWriter}
+ *
+ * @param writer
+ */
+ public abstract void write(PrintWriter writer);
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/Group.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/Group.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/Group.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,27 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.io.PrintWriter;
+
+
+public class Group extends AbstractEntry {
+
+ private String name;
+
+ public Group(String name) {
+ this.name = name;
+ }
+
+ public void write(PrintWriter writer) {
+ Object[] children = getChildren(null);
+ for (int i = 0; i < children.length; i++) {
+ AbstractEntry entry = (AbstractEntry) children[i];
+ entry.write(writer);
+ writer.println();
+ }
+ }
+
+ public String toString() {
+ return name;
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogEntry.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogEntry.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogEntry.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,283 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.internal.views.log.Messages;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+
+public class LogEntry extends AbstractEntry {
+
+ public static final String F_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"; //$NON-NLS-1$
+ private static final SimpleDateFormat F_SDF = new SimpleDateFormat(F_DATE_FORMAT);
+
+ private String pluginId;
+ private int severity;
+ private int code;
+ private String fDateString;
+ private Date fDate;
+ private String message;
+ private String stack;
+ private LogSession session;
+
+ public LogEntry() { // do nothing
+ }
+
+ public LogSession getSession() {
+ if ((session == null) && (parent != null) && (parent instanceof LogEntry))
+ return ((LogEntry) parent).getSession();
+
+ return session;
+ }
+
+ void setSession(LogSession session) {
+ this.session = session;
+ }
+
+ public LogEntry(IStatus status) {
+ processStatus(status);
+ }
+
+ public int getSeverity() {
+ return severity;
+ }
+
+ public boolean isOK() {
+ return severity == IStatus.OK;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public String getPluginId() {
+ return pluginId;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getStack() {
+ return stack;
+ }
+
+ public String getFormattedDate() {
+ if (fDateString == null)
+ fDateString = F_SDF.format(getDate());
+ return fDateString;
+ }
+
+ public Date getDate() {
+ if (fDate == null)
+ fDate = new Date(0); // unknown date - return epoch
+ return fDate;
+ }
+
+ public String getSeverityText() {
+ return getSeverityText(severity);
+ }
+
+ public String toString() {
+ return getSeverityText();
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getImageDescriptor(Object)
+ */
+ public ImageDescriptor getImageDescriptor(Object arg0) {
+ return null;
+ }
+
+ /**
+ * @see IWorkbenchAdapter#getLabel(Object)
+ */
+ public String getLabel(Object obj) {
+ return getSeverityText();
+ }
+
+ private String getSeverityText(int severity) {
+ switch (severity) {
+ case IStatus.ERROR :
+ return Messages.LogView_severity_error;
+ case IStatus.WARNING :
+ return Messages.LogView_severity_warning;
+ case IStatus.INFO :
+ return Messages.LogView_severity_info;
+ case IStatus.OK :
+ return Messages.LogView_severity_ok;
+ }
+ return "?"; //$NON-NLS-1$
+ }
+
+ void processEntry(String line) {
+ //!ENTRY <pluginID> <severity> <code> <date>
+ //!ENTRY <pluginID> <date> if logged by the framework!!!
+ StringTokenizer stok = new StringTokenizer(line, " "); //$NON-NLS-1$
+ int tokenCount = stok.countTokens();
+ boolean noSeverity = stok.countTokens() < 5;
+
+ // no severity means it should be represented as OK
+ if (noSeverity) {
+ severity = 0;
+ code = 0;
+ }
+ StringBuffer dateBuffer = new StringBuffer();
+ for (int i = 0; i < tokenCount; i++) {
+ String token = stok.nextToken();
+ switch (i) {
+ case 0 :
+ break;
+ case 1 :
+ pluginId = token;
+ break;
+ case 2 :
+ if (noSeverity) {
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ } else {
+ severity = parseInteger(token);
+ }
+ break;
+ case 3 :
+ if (noSeverity) {
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ } else
+ code = parseInteger(token);
+ break;
+ default :
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ }
+ }
+ try {
+ Date date = F_SDF.parse(dateBuffer.toString());
+ if (date != null) {
+ fDate = date;
+ fDateString = F_SDF.format(fDate);
+ }
+ } catch (ParseException e) { // do nothing
+ }
+ }
+
+ int processSubEntry(String line) {
+ //!SUBENTRY <depth> <pluginID> <severity> <code> <date>
+ //!SUBENTRY <depth> <pluginID> <date>if logged by the framework!!!
+ StringTokenizer stok = new StringTokenizer(line, " "); //$NON-NLS-1$
+ int tokenCount = stok.countTokens();
+ boolean byFrameWork = stok.countTokens() < 5;
+
+ StringBuffer dateBuffer = new StringBuffer();
+ int depth = 0;
+ for (int i = 0; i < tokenCount; i++) {
+ String token = stok.nextToken();
+ switch (i) {
+ case 0 :
+ break;
+ case 1 :
+ depth = parseInteger(token);
+ break;
+ case 2 :
+ pluginId = token;
+ break;
+ case 3 :
+ if (byFrameWork) {
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ } else {
+ severity = parseInteger(token);
+ }
+ break;
+ case 4 :
+ if (byFrameWork) {
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ } else
+ code = parseInteger(token);
+ break;
+ default :
+ if (dateBuffer.length() > 0)
+ dateBuffer.append(" "); //$NON-NLS-1$
+ dateBuffer.append(token);
+ }
+ }
+ try {
+ Date date = F_SDF.parse(dateBuffer.toString());
+ if (date != null) {
+ fDate = date;
+ fDateString = F_SDF.format(fDate);
+ }
+ } catch (ParseException e) { // do nothing
+ }
+ return depth;
+ }
+
+ private int parseInteger(String token) {
+ try {
+ return Integer.parseInt(token);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ void setStack(String stack) {
+ this.stack = stack;
+ }
+
+ void setMessage(String message) {
+ this.message = message;
+ }
+
+ private void processStatus(IStatus status) {
+ pluginId = status.getPlugin();
+ severity = status.getSeverity();
+ code = status.getCode();
+ fDate = new Date();
+ fDateString = F_SDF.format(fDate);
+ message = status.getMessage();
+ Throwable throwable = status.getException();
+ if (throwable != null) {
+ StringWriter swriter = new StringWriter();
+ PrintWriter pwriter = new PrintWriter(swriter);
+ throwable.printStackTrace(pwriter);
+ pwriter.flush();
+ pwriter.close();
+ stack = swriter.toString();
+ }
+ IStatus[] schildren = status.getChildren();
+ if (schildren.length > 0) {
+ for (int i = 0; i < schildren.length; i++) {
+ LogEntry child = new LogEntry(schildren[i]);
+ addChild(child);
+ }
+ }
+ }
+
+ public void write(PrintWriter writer) {
+ if (session != null)
+ writer.println(session.getSessionData());
+ writer.println(getSeverityText());
+ if (fDate != null)
+ writer.println(getDate());
+
+ if (message != null)
+ writer.println(getMessage());
+
+ if (stack != null) {
+ writer.println();
+ writer.println(stack);
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogLabelProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogLabelProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogLabelProvider.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,117 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.util.Date;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.provisional.ManagedUIDecorator;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.extensions.polling.JMXPoller;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
+import org.jboss.ide.eclipse.as.ui.views.ServerLogView.EventCategory;
+
+public class LogLabelProvider extends LabelProvider {
+ public Image getImage(Object element) {
+ if( element instanceof EventCategory ) {
+ int type = ((EventCategory)element).getType();
+ if( type == IEventCodes.POLLING_CODE)
+ return new ManagedUIDecorator().getStateImage(IServer.STATE_STARTING, ILaunchManager.RUN_MODE, 1);
+ if( type == IEventCodes.PUBLISHING_CODE)
+ return JBossServerUISharedImages.getImage(JBossServerUISharedImages.PUBLISH_IMAGE);
+ }
+
+
+ if( element instanceof LogEntry) {
+ int code = ((LogEntry)element).getCode();
+ int majorType = code & IEventCodes.MAJOR_TYPE_MASK;
+ switch(majorType) {
+ case IEventCodes.POLLING_CODE:
+ return handlePollImage((LogEntry)element, code);
+ case IEventCodes.PUBLISHING_CODE:
+ return handlePublishImage((LogEntry)element, code);
+ }
+ }
+ return null;
+ }
+
+ public Image handlePublishImage(LogEntry element, int code) {
+ if( (code & IEventCodes.SINGLE_FILE_SUCCESS_MASK) == 0)
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); // error
+ if( (code & IEventCodes.SINGLE_FILE_TYPE_MASK) == 0)
+ return JBossServerUISharedImages.getImage(JBossServerUISharedImages.PUBLISH_IMAGE);
+ else
+ return JBossServerUISharedImages.getImage(JBossServerUISharedImages.UNPUBLISH_IMAGE);
+ }
+
+ public Image handlePollImage(LogEntry element, int code) {
+ if( (code & IEventCodes.FULL_POLLER_MASK) == IEventCodes.POLLING_ROOT_CODE) {
+ int state = (code & PollThread.STATE_MASK) >> 3;
+ return new ManagedUIDecorator().getStateImage(state, ILaunchManager.RUN_MODE, 1);
+ } else if( (code & IEventCodes.FULL_POLLER_MASK) == IEventCodes.JMXPOLLER_CODE) {
+ if( element.getSeverity() == IStatus.WARNING)
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
+ int state = code & 0xF;
+ switch(state) {
+ case JMXPoller.STATE_STARTED:
+ return new ManagedUIDecorator().getStateImage(IServer.STATE_STARTED, ILaunchManager.RUN_MODE, 1);
+ case JMXPoller.STATE_STOPPED:
+ return new ManagedUIDecorator().getStateImage(IServer.STATE_STOPPED, ILaunchManager.RUN_MODE, 1);
+ case JMXPoller.STATE_TRANSITION:
+ return new ManagedUIDecorator().getStateImage(IServer.STATE_STARTING, ILaunchManager.RUN_MODE, 1);
+ }
+ } else if( (code & IEventCodes.FULL_POLLER_MASK) == IEventCodes.BEHAVIOR_STATE_CODE) {
+ switch(code) {
+ case IEventCodes.BEHAVIOR_FORCE_STOP:
+ case IEventCodes.BEHAVIOR_FORCE_STOP_FAILED:
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ case IEventCodes.BEHAVIOR_PROCESS_TERMINATED:
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
+ }
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ if( element instanceof EventCategory ) {
+ int type = ((EventCategory)element).getType();
+ if( type == IEventCodes.POLLING_CODE)
+ return "Server Startup / Shutdown";
+ if( type == IEventCodes.PUBLISHING_CODE)
+ return "Publishing";
+ }
+
+
+ if( element instanceof LogEntry ) {
+ // queue for Decoration
+ String message = ((LogEntry)element).getMessage();
+ return message + addSuffix((LogEntry)element);
+ }
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+
+ protected String addSuffix(LogEntry entry) {
+ long diff = new Date().getTime() - entry.getDate().getTime();
+ long sec = diff / 1000;
+ long minutes = sec / 60;
+ if( minutes > 0 )
+ sec -= (minutes * 60);
+ long hours = minutes / 60;
+ if( hours > 0 ) {
+ minutes -= (hours * 60);
+ sec -= (hours * 60 * 60);
+ }
+ if( hours > 0 ) {
+ return " [" + hours + " hours, " + minutes + " minutes ago]";
+ } else if( minutes > 0 ) {
+ return " [" + minutes + " minutes, " + sec + " seconds ago]";
+ } else {
+ return " [" + sec + " seconds ago]";
+ }
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogReader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogReader.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogReader.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,235 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.internal.views.log.TailInputStream;
+
+public class LogReader {
+ private static final int SESSION_STATE = 10;
+ public static final long MAX_FILE_LENGTH = 1024 * 1024;
+ private static final int ENTRY_STATE = 20;
+ private static final int SUBENTRY_STATE = 30;
+ private static final int MESSAGE_STATE = 40;
+ private static final int STACK_STATE = 50;
+ private static final int TEXT_STATE = 60;
+ private static final int UNKNOWN_STATE = 70;
+
+ public static LogSession parseLogFile(File file, List entries, IMemento memento) {
+ if (!file.exists())
+ return null;
+
+// if (memento.getString(LogView.P_USE_LIMIT).equals("true") //$NON-NLS-1$
+// && memento.getInteger(LogView.P_LOG_LIMIT).intValue() == 0)
+// return null;
+
+ ArrayList parents = new ArrayList();
+ LogEntry current = null;
+ LogSession session = null;
+ int writerState = UNKNOWN_STATE;
+ StringWriter swriter = null;
+ PrintWriter writer = null;
+ int state = UNKNOWN_STATE;
+ LogSession currentSession = null;
+ BufferedReader reader = null;
+ try {
+
+ reader = new BufferedReader(new InputStreamReader(new TailInputStream(file, MAX_FILE_LENGTH), "UTF-8")); //$NON-NLS-1$
+ for (;;) {
+ String line = reader.readLine();
+ if (line == null)
+ break;
+ line = line.trim();
+
+ if (line.startsWith("!SESSION")) { //$NON-NLS-1$
+ state = SESSION_STATE;
+ } else if (line.startsWith("!ENTRY")) { //$NON-NLS-1$
+ state = ENTRY_STATE;
+ } else if (line.startsWith("!SUBENTRY")) { //$NON-NLS-1$
+ state = SUBENTRY_STATE;
+ } else if (line.startsWith("!MESSAGE")) { //$NON-NLS-1$
+ state = MESSAGE_STATE;
+ } else if (line.startsWith("!STACK")) { //$NON-NLS-1$
+ state = STACK_STATE;
+ } else
+ state = TEXT_STATE;
+
+ if (state == TEXT_STATE) {
+ if (writer != null)
+ writer.println(line);
+ continue;
+ }
+
+ if (writer != null) {
+ setData(current, session, writerState, swriter);
+ writerState = UNKNOWN_STATE;
+ swriter = null;
+ writer.close();
+ writer = null;
+ }
+
+ if (state == STACK_STATE) {
+ swriter = new StringWriter();
+ writer = new PrintWriter(swriter, true);
+ writerState = STACK_STATE;
+ } else if (state == SESSION_STATE) {
+ session = new LogSession();
+ session.processLogLine(line);
+ swriter = new StringWriter();
+ writer = new PrintWriter(swriter, true);
+ writerState = SESSION_STATE;
+ currentSession = updateCurrentSession(currentSession, session);
+ // if current session is most recent and not showing all sessions
+// if (currentSession.equals(session) && !memento.getString(LogView.P_SHOW_ALL_SESSIONS).equals("true")) //$NON-NLS-1$
+// entries.clear();
+ } else if (state == ENTRY_STATE) {
+ if (currentSession == null) { // create fake session if there was no any
+ currentSession = new LogSession();
+ }
+ LogEntry entry = new LogEntry();
+ entry.setSession(currentSession);
+ entry.processEntry(line);
+ setNewParent(parents, entry, 0);
+ current = entry;
+ addEntry(current, entries, memento);
+ } else if (state == SUBENTRY_STATE) {
+ if (parents.size() > 0) {
+ LogEntry entry = new LogEntry();
+ entry.setSession(session);
+ int depth = entry.processSubEntry(line);
+ setNewParent(parents, entry, depth);
+ current = entry;
+ LogEntry parent = (LogEntry) parents.get(depth - 1);
+ parent.addChild(entry);
+ }
+ } else if (state == MESSAGE_STATE) {
+ swriter = new StringWriter();
+ writer = new PrintWriter(swriter, true);
+ String message = ""; //$NON-NLS-1$
+ if (line.length() > 8)
+ message = line.substring(9).trim();
+ message = message.trim();
+ if (current != null)
+ current.setMessage(message);
+ writerState = MESSAGE_STATE;
+ }
+ }
+
+ if (swriter != null && current != null && writerState == STACK_STATE) {
+ writerState = UNKNOWN_STATE;
+ current.setStack(swriter.toString());
+ }
+ } catch (FileNotFoundException e) { // do nothing
+ } catch (IOException e) { // do nothing
+ } finally {
+ try {
+ if (reader != null)
+ reader.close();
+ } catch (IOException e1) { // do nothing
+ }
+ if (writer != null) {
+ setData(current, session, writerState, swriter);
+ writer.close();
+ }
+ }
+
+ return currentSession;
+ }
+
+ /**
+ * Assigns data from writer to appropriate field of current Log Entry or Session,
+ * depending on writer state.
+ */
+ private static void setData(LogEntry current, LogSession session, int writerState, StringWriter swriter) {
+ if (writerState == STACK_STATE && current != null) {
+ current.setStack(swriter.toString());
+ } else if (writerState == SESSION_STATE && session != null) {
+ session.setSessionData(swriter.toString());
+ } else if (writerState == MESSAGE_STATE && current != null) {
+ StringBuffer sb = new StringBuffer(current.getMessage());
+ sb.append(swriter.toString());
+ current.setMessage(sb.toString().trim());
+ }
+ }
+
+ /**
+ * Updates the {@link currentSession} to be the one that is not null or has most recent date.
+ * @param session
+ */
+ private static LogSession updateCurrentSession(LogSession currentSession, LogSession session) {
+ if (currentSession == null) {
+ return session;
+ }
+ Date currentDate = currentSession.getDate();
+ Date sessionDate = session.getDate();
+ if (currentDate == null && sessionDate != null)
+ return session;
+ else if (currentDate != null && sessionDate == null)
+ return session;
+ else if (currentDate != null && sessionDate != null && sessionDate.after(currentDate))
+ return session;
+
+ return currentSession;
+ }
+
+ /**
+ * Adds entry to the list if it's not filtered. Removes entries exceeding the count limit.
+ *
+ * @param entry
+ * @param entries
+ * @param memento
+ */
+ private static void addEntry(LogEntry entry, List entries, IMemento memento) {
+
+ if (isLogged(entry, memento)) {
+ entries.add(entry);
+
+// if (memento.getString(LogView.P_USE_LIMIT).equals("true")) {//$NON-NLS-1$
+// int limit = memento.getInteger(LogView.P_LOG_LIMIT).intValue();
+// if (entries.size() > limit) {
+// entries.remove(0);
+// }
+// }
+ }
+ }
+
+ /**
+ * Returns whether given entry is logged (true) or filtered (false).
+ *
+ * @param entry
+ * @param memento
+ * @return is entry logged or filtered
+ */
+ public static boolean isLogged(LogEntry entry, IMemento memento) {
+ return true;
+// int severity = entry.getSeverity();
+// switch (severity) {
+// case IStatus.INFO :
+// return memento.getString(LogView.P_LOG_INFO).equals("true"); //$NON-NLS-1$
+// case IStatus.WARNING :
+// return memento.getString(LogView.P_LOG_WARNING).equals("true"); //$NON-NLS-1$
+// case IStatus.ERROR :
+// return memento.getString(LogView.P_LOG_ERROR).equals("true"); //$NON-NLS-1$
+// case IStatus.OK :
+// return memento.getString(LogView.P_LOG_OK).equals("true"); //$NON-NLS-1$
+// }
+//
+// return false;
+ }
+
+ private static void setNewParent(ArrayList parents, LogEntry entry, int depth) {
+ if (depth + 1 > parents.size())
+ parents.add(entry);
+ else
+ parents.set(depth, entry);
+ }
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogSession.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogSession.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/LogSession.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -0,0 +1,54 @@
+package org.jboss.ide.eclipse.as.ui.views;
+
+import java.io.PrintWriter;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.ui.internal.views.log.Messages;
+
+public class LogSession extends Group {
+ private String sessionData;
+ private Date date;
+
+ public LogSession() {
+ super(Messages.LogViewLabelProvider_Session);
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(String dateString) {
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); //$NON-NLS-1$
+ try {
+ date = formatter.parse(dateString);
+ } catch (ParseException e) { // do nothing
+ }
+ }
+
+ public String getSessionData() {
+ return sessionData;
+ }
+
+ void setSessionData(String data) {
+ this.sessionData = data;
+ }
+
+ public void processLogLine(String line) {
+ // process "!SESSION <dateUnknownFormat> ----------------------------"
+ line = line.substring(9); // strip "!SESSION "
+ int delim = line.indexOf("----"); //$NON-NLS-1$ // single "-" may be in date, so take few for sure
+ if (delim == -1)
+ return;
+
+ String dateBuffer = line.substring(0, delim).trim();
+ setDate(dateBuffer);
+ }
+
+ public void write(PrintWriter writer) {
+ writer.write(sessionData);
+ writer.println();
+ super.write(writer);
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java 2008-12-02 01:53:58 UTC (rev 12191)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java 2008-12-02 02:02:41 UTC (rev 12192)
@@ -1,28 +1,95 @@
package org.jboss.ide.eclipse.as.ui.views;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.internal.views.log.LogView;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.internal.views.log.Messages;
+import org.eclipse.ui.internal.views.log.SharedImages;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ViewPart;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.extensions.events.IServerLogListener;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
-public class ServerLogView extends LogView implements IServerLogListener {
+public class ServerLogView extends ViewPart implements IServerLogListener {
public static final String VIEW_ID = "org.jboss.ide.eclipse.as.ui.view.serverLogView";
private IServer server;
- private boolean subclassLogging = false;
+ private TreeViewer viewer;
+ private File fInputFile;
+ private IMemento fMemento;
+ private Action fDeleteLogAction, fOpenLogAction;
+ private List<AbstractEntry> elements;
public ServerLogView() {
super();
+ elements = new ArrayList<AbstractEntry>();
}
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ fMemento = memento;
+ }
public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- Platform.removeLogListener(this);
- setLogFile(ServerLogger.getDefault().getServerLogFile(null));
+ Composite child = new Composite(parent, SWT.NONE);
+ child.setLayout(new FillLayout());
+ viewer = new TreeViewer(child);
+ viewer.setContentProvider(new LogContentProvider());
+ viewer.setLabelProvider(new LogLabelProvider());
+ viewer.setInput(this);
+
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection sel = (IStructuredSelection)event.getSelection();
+ Object[] arr = sel.toArray();
+ viewer.update(arr, null);
+ }
+ });
+
+ IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager();
+ fDeleteLogAction = createDeleteLogAction();
+ toolbar.add(fDeleteLogAction);
+ fOpenLogAction = createOpenLogAction();
+ toolbar.add(fOpenLogAction);
+
+ setLogFile(null);
}
public void setServer(IServer server) {
@@ -37,22 +104,229 @@
super.dispose();
}
- protected void setLogFile(File f) {
- super.setLogFile(f);
+ protected void setLogFile(File file) {
+ fInputFile = file;
+ elements.clear();
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ monitor.beginTask("Importing Server Log", IProgressMonitor.UNKNOWN);
+ List<AbstractEntry> entries = new ArrayList<AbstractEntry>();
+ LogReader.parseLogFile(fInputFile, entries, fMemento);
+ elements.addAll(entries);
+ }
+ };
+ ProgressMonitorDialog pmd = new ProgressMonitorDialog(getViewSite().getShell());
+ try {
+ pmd.run(true, true, op);
+ } catch (InvocationTargetException e) { // do nothing
+ } catch (InterruptedException e) { // do nothing
+ } finally {
+ asyncRefresh(false);
+ }
+
+ updateButtons();
}
- // This must be done because too many fields / classes are private
- // and the super.logging(IStatus, String) method does nothing
- // if the platform log is not opened. Which is stupid.
+ private void updateButtons() {
+ fDeleteLogAction.setEnabled(fInputFile != null && fInputFile.exists());
+ fOpenLogAction.setEnabled(fInputFile != null && fInputFile.exists());
+ }
+
+ private void asyncRefresh(final boolean activate) {
+ if (viewer.getTree().isDisposed())
+ return;
+ Display display = viewer.getTree().getDisplay();
+ final ViewPart view = this;
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ IServer selected = ServerLogger.findServerForFile(fInputFile);
+ setContentDescription(selected == null ? "No Log Selected" : selected.getName());
+ if (!viewer.getTree().isDisposed()) {
+ viewer.refresh();
+ viewer.expandToLevel(2);
+ if (activate) {
+ IWorkbenchPage page = JBossServerUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if (page != null)
+ page.bringToTop(view);
+ }
+ }
+ }
+ });
+ }
+ }
+
public void logging(IStatus status, IServer server) {
if( server != null && server.equals(this.server)) {
- subclassLogging = true;
- super.logging(status, null);
- subclassLogging = false;
+ LogEntry entry = new LogEntry(status);
+ elements.add(entry);
+ asyncRefresh(false);
}
}
+
+ public void setFocus() {
+ }
- public boolean isPlatformLogOpen() {
- return subclassLogging ? true : super.isPlatformLogOpen();
+ // providers
+ private class LogContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if( parentElement instanceof AbstractEntry ) {
+ return ((AbstractEntry)parentElement).getChildren(parentElement);
+ }
+
+ if( parentElement instanceof EventCategory ) {
+ int type = ((EventCategory)parentElement).getType();
+ int type2;
+ ArrayList<AbstractEntry> returnable = new ArrayList<AbstractEntry>();
+ AbstractEntry[] entries = ServerLogView.this.getElements();
+ for( int i = 0; i < entries.length; i++ ) {
+ if( entries[i] instanceof LogEntry ) {
+ type2 = ((LogEntry)entries[i]).getCode() & IEventCodes.MAJOR_TYPE_MASK;
+ if( type == type2 )
+ returnable.add(entries[i]);
+ }
+ }
+ return returnable.toArray(new AbstractEntry[returnable.size()]);
+ }
+
+ return new Object[]{};
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof AbstractEntry )
+ return ((AbstractEntry)element).getParent(null);
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if( !shouldSort()) {
+ return ServerLogView.this.getElements();
+ }
+ ArrayList<EventCategory> cats = new ArrayList<EventCategory>();
+ AbstractEntry[] entries = ServerLogView.this.getElements();
+ for( int i = 0; i < entries.length; i++ ) {
+ if( entries[i] instanceof LogEntry ) {
+ int type = ((LogEntry)entries[i]).getCode() & IEventCodes.MAJOR_TYPE_MASK;
+ if( !cats.contains(new EventCategory(type)))
+ cats.add(new EventCategory(type));
+ }
+ }
+ return cats.toArray(new EventCategory[cats.size()]);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
}
+
+ public static class EventCategory {
+ int val;
+ EventCategory(int i) {
+ this.val = i;
+ }
+ public int getType() {
+ return val;
+ }
+ public boolean equals(Object other) {
+ return other instanceof EventCategory && ((EventCategory)other).getType() == val;
+ }
+ }
+
+ public boolean shouldSort() {
+ return true;
+ }
+
+ public AbstractEntry[] getElements() {
+ return elements.toArray(new AbstractEntry[elements.size()]);
+ }
+
+
+
+ /* Stolen from log view and can be changed but in a rush */
+ private Action createOpenLogAction() {
+ Action action = new Action() {
+ public void run() {
+ openLog();
+ }
+ };
+ action.setText(Messages.LogView_view_currentLog);
+ action.setImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_OPEN_LOG));
+ action.setDisabledImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_OPEN_LOG_DISABLED));
+ action.setEnabled(fInputFile != null && fInputFile.exists());
+ action.setToolTipText(Messages.LogView_view_currentLog_tooltip);
+ return action;
+ }
+
+ private void openLog() {
+ try {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ IWorkbenchPage page = win.getActivePage();
+ IFile eclipseFile = ResourcesPlugin.getWorkspace()
+ .getRoot().getFileForLocation(
+ new Path(fInputFile.getAbsolutePath()));
+ IFileStore fileStore = EFS.getLocalFileSystem()
+ .fromLocalFile(fInputFile);
+ if (eclipseFile != null) {
+ IEditorInput input = new FileEditorInput(
+ eclipseFile);
+ IEditorDescriptor desc = PlatformUI.getWorkbench()
+ .getEditorRegistry().getDefaultEditor(
+ fInputFile.getName());
+ if (desc != null)
+ page.openEditor(input, desc.getId());
+ } else if (fileStore != null) {
+ IEditorInput input = new FileStoreEditorInput(
+ fileStore);
+ IEditorDescriptor desc = PlatformUI.getWorkbench()
+ .getEditorRegistry().getDefaultEditor(
+ "dummy.txt");
+ if (desc != null)
+ page.openEditor(input, desc.getId());
+ }
+ } catch( PartInitException pie) {
+ IStatus status = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, pie.getMessage(), pie);
+ JBossServerUIPlugin.getDefault().getLog().log(status);
+ }
+ }
+
+ private Action createDeleteLogAction() {
+ Action action = new Action(Messages.LogView_delete) {
+ public void run() {
+ doDeleteLog();
+ }
+ };
+ action.setToolTipText(Messages.LogView_delete_tooltip);
+ action.setImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_REMOVE_LOG));
+ action.setDisabledImageDescriptor(SharedImages.getImageDescriptor(SharedImages.DESC_REMOVE_LOG_DISABLED));
+ action.setEnabled(fInputFile != null && fInputFile.exists());
+ return action;
+ }
+
+ private void doDeleteLog() {
+ String title = Messages.LogView_confirmDelete_title;
+ String message = Messages.LogView_confirmDelete_message;
+ if (!MessageDialog.openConfirm(viewer.getTree().getShell(), title, message))
+ return;
+ if (fInputFile.delete() || elements.size() > 0) {
+ handleClear();
+ }
+ }
+
+ protected void handleClear() {
+ BusyIndicator.showWhile(viewer.getTree().getDisplay(), new Runnable() {
+ public void run() {
+ elements.clear();
+ asyncRefresh(false);
+ }
+ });
+ }
+
}
17 years
JBoss Tools SVN: r12191 - trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-12-01 20:53:58 -0500 (Mon, 01 Dec 2008)
New Revision: 12191
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetActionProvider.java
Log:
JBIDE-3292 - NPE, was not using the setSelection() call in all proper places, only some.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetActionProvider.java 2008-12-01 22:00:23 UTC (rev 12190)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/ui/FilesetActionProvider.java 2008-12-02 01:53:58 UTC (rev 12191)
@@ -15,9 +15,7 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.window.Window;
@@ -78,12 +76,8 @@
public void fillContextMenu(IMenuManager menu) {
ICommonViewerSite site = actionSite.getViewSite();
- IStructuredSelection selection = null;
if (site instanceof ICommonViewerWorkbenchSite) {
- ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
- selection = (IStructuredSelection) wsSite.getSelectionProvider()
- .getSelection();
- selected = selection.toArray();
+ setSelection();
if( selected == null )
return;
if( selected.length == 1 && selected[0] instanceof ServerWrapper ) {
17 years