JBoss Tools SVN: r36919 - trunk/central/plugins/org.jboss.tools.community.central.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-12-03 17:28:32 -0500 (Sat, 03 Dec 2011)
New Revision: 36919
Added:
trunk/central/plugins/org.jboss.tools.community.central/.classpath
Log:
add .classpath file to org.jboss.tools.community.central
Added: trunk/central/plugins/org.jboss.tools.community.central/.classpath
===================================================================
--- trunk/central/plugins/org.jboss.tools.community.central/.classpath (rev 0)
+++ trunk/central/plugins/org.jboss.tools.community.central/.classpath 2011-12-03 22:28:32 UTC (rev 36919)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
13 years, 1 month
JBoss Tools SVN: r36918 - trunk/central/plugins/org.jboss.tools.community.central.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-12-03 17:28:24 -0500 (Sat, 03 Dec 2011)
New Revision: 36918
Modified:
trunk/central/plugins/org.jboss.tools.community.central/.project
Log:
add java builder/nature to org.jboss.tools.community.central
Modified: trunk/central/plugins/org.jboss.tools.community.central/.project
===================================================================
--- trunk/central/plugins/org.jboss.tools.community.central/.project 2011-12-03 21:38:23 UTC (rev 36917)
+++ trunk/central/plugins/org.jboss.tools.community.central/.project 2011-12-03 22:28:24 UTC (rev 36918)
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
@@ -18,5 +23,6 @@
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
13 years, 1 month
JBoss Tools SVN: r36917 - in trunk/forge/plugins: org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-12-03 16:38:23 -0500 (Sat, 03 Dec 2011)
New Revision: 36917
Added:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandFilter.java
Removed:
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PrettyFacesPostProcessor.java
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java
trunk/forge/plugins/org.jboss.tools.forge.runtime/META-INF/MANIFEST.MF
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/FieldPostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessorHelper.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/NewProjectPostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PersistencePostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PickUpPostProcessor.java
Log:
JBIDE-10266: Improve support for pick-up command
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime/META-INF/MANIFEST.MF 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/META-INF/MANIFEST.MF 2011-12-03 21:38:23 UTC (rev 36917)
@@ -17,3 +17,5 @@
org.jboss.forge.shell.events,
org.jboss.forge.shell.spi
Bundle-Vendor: JBoss by Red Hat
+Eclipse-BundleShape: dir
+
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/AllCommandsInterceptor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -15,16 +15,22 @@
@Override
public String intercept(String line) {
- Project project = shell.getCurrentProject();
- String str = "no project";
- if (project != null) {
- str = project.getProjectRoot().getName();
- }
- sendEscaped("Intercepted Command: " + line + " Current Project Directory: " + str);
if (line.startsWith("open ")) {
- str = shell.getCurrentResource().getFullyQualifiedName();
- sendEscaped("Execute Command: " + line + " Current Resource: " + str);
- return null;
+ String crn = shell.getCurrentResource().getFullyQualifiedName();
+ String crt = shell.getCurrentResource().getClass().getSimpleName();
+ Project project = shell.getCurrentProject();
+ String cpn = "";
+ if (project != null) {
+ cpn = project.getProjectRoot().getFullyQualifiedName();
+ }
+ String par = line.substring(5);
+ sendEscaped(
+ " EC: " + line +
+ " CRN: " + crn +
+ " CRT: " + crt +
+ " CPN: " + cpn +
+ " PAR: " + par);
+ return "\n";
}
return line;
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/EventHandler.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,9 +1,13 @@
package org.jboss.tools.forge.runtime.ext;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.jboss.forge.project.Project;
+import org.jboss.forge.resources.Resource;
import org.jboss.forge.shell.Shell;
import org.jboss.forge.shell.events.CommandExecuted;
@@ -15,13 +19,35 @@
private Shell shell;
public void handleCommandExecuted(@Observes CommandExecuted event) {
+ Resource<?> currentResource = shell.getCurrentResource();
+ String currentResourceName = currentResource.getFullyQualifiedName();
+ String currentResourceType = currentResource.getClass().getSimpleName();
Project project = shell.getCurrentProject();
- String str = "no project";
+ String projectName = "";
if (project != null) {
- str = project.getProjectRoot().getName();
+ projectName = project.getProjectRoot().getFullyQualifiedName();
}
+ String parameterString = "";
+ try {
+ Method method = event.getClass().getMethod("getParameters", new Class[] {});
+ Object object = method.invoke(event, new Object[] {});
+ if (object instanceof Object[]) {
+ Object[] parameters = (Object[])object;
+ for (Object parameter : parameters) {
+ parameterString += parameter + " ";
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException e) {}
+
String command = event.getCommand().getParent().getName() + " " + event.getCommand().getName();
- sendEscaped("Executed Command: " + command + " Current Project Directory: " + str);
+ sendEscaped(
+ " EC: " + command +
+ " CRN: " + currentResourceName +
+ " CRT: " + currentResourceType +
+ " CPN: " + projectName +
+ " PAR: " + parameterString);
}
private void sendEscaped(String str) {
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/FieldPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/FieldPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/FieldPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,7 +1,8 @@
package org.jboss.tools.forge.ui.console;
+import java.util.Map;
+
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
@@ -16,34 +17,21 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
+
public class FieldPostProcessor implements ForgeCommandPostProcessor {
@Override
- public void postProcessCommand(String command, String output) {
+ public void postProcess(Map<String, String> commandDetails) {
try {
- int index = output.lastIndexOf("Added field to ");
- if (index == -1) return;
- if (index + 15 > output.length()) return;
- String str = output.substring(index + 15);
- index = str.indexOf(':');
- if (index == -1) return;
- String entityName = str.substring(0, index);
- str = str.substring(index);
- index = str.lastIndexOf(';');
- if (index == -1) return;
- str = str.substring(0, index);
- index = str.lastIndexOf(' ');
- if (index == -1) return;
- String fieldName = str.substring(index + 1);
- IProject project = ForgeCommandPostProcessorHelper.getProject(command);
- if (project == null) return;
- IFile file = project.getFile("/src/main/java/" + entityName.replace('.', '/') + ".java");
+ String crn = commandDetails.get("crn");
+ String par = commandDetails.get("par").trim();
+ IFile file = ForgeCommandPostProcessorHelper.getFile(crn);
if (file == null) return;
IJavaElement javaElement = JavaCore.create(file);
if (javaElement != null && javaElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
try {
IType type = ((ICompilationUnit)javaElement).getTypes()[0];
- IField field = type.getField(fieldName);
+ IField field = type.getField(par);
if (field != null) {
ISourceRange sourceRange = field.getSourceRange();
IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
Added: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandFilter.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandFilter.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandFilter.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -0,0 +1,31 @@
+package org.jboss.tools.forge.ui.console;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.forge.core.io.ForgeHiddenOutputFilter;
+import org.jboss.tools.forge.core.io.ForgeOutputListener;
+import org.jboss.tools.forge.importer.ProjectConfigurationUpdater;
+
+public class ForgeCommandFilter extends ForgeHiddenOutputFilter {
+
+ private ForgeCommandProcessor commandProcessor = new ForgeCommandProcessor();
+
+ public ForgeCommandFilter(ForgeOutputListener listener) {
+ super(listener);
+
+ }
+
+ @Override
+ public void handleFilteredString(String str) {
+ System.out.println("handle filtered string: " + str);
+ if (str.startsWith(" EC: ")) {
+ commandProcessor.postProcess(str);
+ } else if (str.startsWith("POM File Modified: ")) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(str.substring(19));
+ if (project != null) {
+ ProjectConfigurationUpdater.updateProject(project);
+ }
+ }
+ }
+
+}
Property changes on: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandFilter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,7 +1,9 @@
package org.jboss.tools.forge.ui.console;
+import java.util.Map;
+
public interface ForgeCommandPostProcessor {
- void postProcessCommand(String command, String str);
+ void postProcess(Map<String, String> commandDetails);
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessorHelper.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessorHelper.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandPostProcessorHelper.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,34 +1,62 @@
package org.jboss.tools.forge.ui.console;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
public class ForgeCommandPostProcessorHelper {
-
- public static String getProjectName(String command) {
- String result = null;
- int i = command.indexOf("Current Project Directory: ");
- if (i != -1 && command.length() >= i + 27) {
- result = command.substring(i + 27).trim();
- if ("".equals(result)) {
- result = null;
- }
- }
+
+ public static Map<String, String> getCommandDetails(String commandString) {
+ Map<String, String> result = new HashMap<String, String>();
+ int ec = commandString.indexOf(" EC: ");
+ int crn = commandString.indexOf(" CRN: ");
+ int crt = commandString.indexOf(" CRT: ");
+ int cpn = commandString.indexOf(" CPN: ");
+ int par = commandString.indexOf(" PAR: ");
+ result.put("ec", commandString.substring(ec + 5, crn));
+ result.put("crn", commandString.substring(crn + 6, crt));
+ result.put("crt", commandString.substring(crt + 6, cpn));
+ result.put("cpn", commandString.substring(cpn + 6, par));
+ result.put("par", commandString.substring(par + 6));
return result;
}
+
+// public static String getProjectName(String command) {
+// String result = null;
+// int i = command.indexOf("Current Project Directory: ");
+// if (i != -1 && command.length() >= i + 27) {
+// result = command.substring(i + 27).trim();
+// if ("".equals(result)) {
+// result = null;
+// }
+// }
+// return result;
+// }
- public static IProject getProject(String command) {
- IProject result = null;
- String projectName = getProjectName(command);
- if (projectName != null) {
- result = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- }
- return result;
+ public static IFile getFile(String fullyQualifiedName) {
+ IPath filePath = new Path(fullyQualifiedName);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = root.getFileForLocation(filePath);
+ return file;
}
+ public static IProject getProject(String projectFullyQualifiedName) {
+ IPath projectPath = new Path(projectFullyQualifiedName);
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IContainer container = root.getContainerForLocation(projectPath);
+ return container.getProject();
+ }
+
public static IWorkbenchPage getActiveWorkbenchPage() {
IWorkbenchPage result = null;
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -18,70 +18,59 @@
static Map<String, ForgeCommandPostProcessor> POST_PROCESSORS = null;
- public static Map<String, ForgeCommandPostProcessor> getPostProcessors() {
+ private static Map<String, ForgeCommandPostProcessor> getPostProcessors() {
if (POST_PROCESSORS == null) {
POST_PROCESSORS = new HashMap<String, ForgeCommandPostProcessor>();
- POST_PROCESSORS.put("new-project", new NewProjectPostProcessor());
- POST_PROCESSORS.put("persistence", new PersistencePostProcessor());
- POST_PROCESSORS.put("pick-up", new PickUpPostProcessor());
+ POST_PROCESSORS.put("new-project", new NewProjectPostProcessor()); // OK
+ POST_PROCESSORS.put("persistence", new PersistencePostProcessor()); // OK
+ POST_PROCESSORS.put("pick-up", new PickUpPostProcessor()); // OK
+ POST_PROCESSORS.put("open", new OpenPostProcessor());
POST_PROCESSORS.put("field", new FieldPostProcessor());
- POST_PROCESSORS.put("prettyfaces", new PrettyFacesPostProcessor());
}
return POST_PROCESSORS;
}
- private String currentCommand;
- private StringBuffer buffer = new StringBuffer();
-
- public void startCommand(String command) {
- buffer.setLength(0);
- currentCommand = command;
- }
-
- public void stopCurrentCommand() {
- if (currentCommand != null) {
- final String command = currentCommand;
- final String output = buffer.toString();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- postProcessCurrentCommand(command, output);
- }
- });
+ private String getCommand(String commandString) {
+ String result = null;
+ int i = commandString.indexOf(' ', 5);
+ if (i != -1) {
+ result = commandString.substring(5, i);
}
- currentCommand = null;
+ return result;
}
- public void executeCommand(final String line, final String resourcePath) {
+ public void postProcess(final String commandString) {
+ if (!commandString.startsWith(" EC: ")) return;
+ String command = getCommand(commandString);
+ if (command == null) return;
+ refreshWorkspace();
+ final ForgeCommandPostProcessor postProcessor = getPostProcessors().get(command);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- new OpenPostProcessor().postProcess(line, resourcePath);
- }
+ if (postProcessor != null) {
+ postProcessor.postProcess(getCommandDetails(commandString));
+ }
+ showForgeConsole();
+ }
});
}
- public void log(String str) {
- if (currentCommand != null) {
- buffer.append(str);
- }
+ private Map<String, String> getCommandDetails(String commandString) {
+ Map<String, String> result = new HashMap<String, String>();
+ int ec = commandString.indexOf(" EC: ");
+ int crn = commandString.indexOf(" CRN: ");
+ int crt = commandString.indexOf(" CRT: ");
+ int cpn = commandString.indexOf(" CPN: ");
+ int par = commandString.indexOf(" PAR: ");
+ result.put("ec", commandString.substring(ec + 5, crn));
+ result.put("crn", commandString.substring(crn + 6, crt));
+ result.put("crt", commandString.substring(crt + 6, cpn));
+ result.put("cpn", commandString.substring(cpn + 6, par));
+ result.put("par", commandString.substring(par + 6));
+ return result;
}
-
- private void postProcessCurrentCommand(String currentCommand, String output) {
- if (currentCommand == null) return;
- String mainCommand = currentCommand;
- int i = mainCommand.indexOf(' ');
- if (i != -1) {
- mainCommand = currentCommand.substring(0, i);
- }
- refreshWorkspace();
- ForgeCommandPostProcessor postProcessor = getPostProcessors().get(mainCommand);
- if (postProcessor != null) {
- postProcessor.postProcessCommand(currentCommand, output);
- }
- showForgeConsole();
- }
-
+
private void refreshWorkspace() {
try {
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
@@ -90,15 +79,14 @@
}
}
- private void showForgeConsole() {
+ private void showForgeConsole() {
try {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
workbenchPage.showView("org.jboss.tools.forge.console").setFocus();
} catch (PartInitException e) {
ForgeUIPlugin.log(e);
- }
-
+ }
}
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -3,8 +3,6 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
@@ -21,10 +19,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.forge.core.io.ForgeAnsiCommandFilter;
-import org.jboss.tools.forge.core.io.ForgeHiddenOutputFilter;
import org.jboss.tools.forge.core.io.ForgeOutputListener;
import org.jboss.tools.forge.core.process.ForgeRuntime;
-import org.jboss.tools.forge.importer.ProjectConfigurationUpdater;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
public class ForgeTextViewer extends TextViewer {
@@ -67,7 +63,6 @@
}
}
- private ForgeCommandProcessor commandProcessor;
private RuntimeStopListener stopListener;
private ForgeOutputListener outputListener;
private ForgeRuntime runtime;
@@ -84,7 +79,6 @@
private void initialize() {
initDocument();
initViewer();
- initForgeCommandProcessor();
initOutputListener();
initStopListener();
}
@@ -145,15 +139,10 @@
return Display.getDefault().getSystemColor(colorCode);
}
- private void initForgeCommandProcessor() {
- commandProcessor = new ForgeCommandProcessor();
- }
-
private void initOutputListener() {
ForgeOutputListener target = new ForgeOutputListener() {
@Override
public void outputAvailable(final String output) {
- commandProcessor.log(output);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
@@ -178,32 +167,33 @@
executeAnsiCommand(command);
}
};
- outputListener = new ForgeHiddenOutputFilter(ansiCommandFilter) {
- @Override
- public void handleFilteredString(String str) {
- System.out.println("handle filtered string: " + str);
- if (str.startsWith("Intercepted Command: ")) {
- commandProcessor.startCommand(str.substring(21));
- } else if (str.startsWith("Executed Command: ")) {
- commandProcessor.stopCurrentCommand();
- } else if (str.startsWith("Execute Command: ")) {
- str = str.substring(17);
- int index = str.indexOf("Current Resource: ");
- String line = "";
- String resource = "";
- if (index != -1) {
- line = str.substring(0, index);
- resource = str.substring(index + 18);
- commandProcessor.executeCommand(line, resource);
- }
- } else if (str.startsWith("POM File Modified: ")) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(str.substring(19));
- if (project != null) {
- ProjectConfigurationUpdater.updateProject(project);
- }
- }
- }
- };
+ outputListener = new ForgeCommandFilter(ansiCommandFilter);
+// outputListener = new ForgeHiddenOutputFilter(ansiCommandFilter) {
+// @Override
+// public void handleFilteredString(String str) {
+// System.out.println("handle filtered string: " + str);
+// if (str.startsWith("Intercepted Command: ")) {
+// commandProcessor.startCommand(str.substring(21));
+// } else if (str.startsWith("Executed Command: ")) {
+// commandProcessor.stopCurrentCommand(str);
+// } else if (str.startsWith("Execute Command: ")) {
+// str = str.substring(17);
+// int index = str.indexOf("Current Resource: ");
+// String line = "";
+// String resource = "";
+// if (index != -1) {
+// line = str.substring(0, index);
+// resource = str.substring(index + 18);
+// commandProcessor.executeCommand(line, resource);
+// }
+// } else if (str.startsWith("POM File Modified: ")) {
+// IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(str.substring(19));
+// if (project != null) {
+// ProjectConfigurationUpdater.updateProject(project);
+// }
+// }
+// }
+// };
runtime.addOutputListener(outputListener);
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/NewProjectPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/NewProjectPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/NewProjectPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,23 +1,16 @@
package org.jboss.tools.forge.ui.console;
+import java.util.Map;
+
import org.jboss.tools.forge.importer.ProjectImporter;
+
public class NewProjectPostProcessor implements ForgeCommandPostProcessor {
@Override
- public void postProcessCommand(String command, String output) {
- int index = output.lastIndexOf("***SUCCESS*** Created project [");
- if (index == -1) return;
- if (index + 31 > output.length()) return;
- output = output.substring(index + 31);
- index = output.lastIndexOf("] in new working directory [");
- if (index == -1) return;
- if (index + 28 > output.length()) return;
- output = output.substring(index + 28);
- index = output.indexOf("]");
- if (index == -1) return;
- String projectPath = output.substring(0, index);
- index = projectPath.lastIndexOf('/');
+ public void postProcess(Map<String, String> commandDetails) {
+ String projectPath = commandDetails.get("cpn");
+ int index = projectPath.lastIndexOf('/');
String projectDirName = projectPath.substring(index + 1);
String projectBaseDirPath = projectPath.substring(0, index);
ProjectImporter importer = new ProjectImporter(projectBaseDirPath, projectDirName);
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/OpenPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,168 +1,19 @@
package org.jboss.tools.forge.ui.console;
-import java.io.File;
-import java.util.ArrayList;
+import java.util.Map;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.navigator.CommonNavigator;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.jboss.tools.forge.ui.ForgeUIPlugin;
-
-public class OpenPostProcessor {
+public class OpenPostProcessor extends PickUpPostProcessor {
- public void postProcess(String line, String currentResourcePath) {
- String resourceToOpen = line.substring(5).trim();
- if (!resourceToOpen.startsWith("/")) {
- resourceToOpen = currentResourcePath + File.separator + resourceToOpen;
- }
- IPath path = new Path(resourceToOpen);
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(resourceToOpen));
- if (fileStore.fetchInfo().isDirectory()) {
- IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(path);
- if (container != null) {
- expandWorkspaceDirectory(container);
- } else {
- expandSystemDirectory(fileStore);
- }
+ protected String getResourceToOpen(Map<String, String> commandDetails) {
+ String par = commandDetails.get("par");
+ if (par.startsWith("~")) {
+ return System.getProperty("user.home") + "/" + par;
+ } else if (!par.startsWith("/")) {
+ String crn = commandDetails.get("crn");
+ return crn + "/" + par;
} else {
- openFileInEditor(fileStore);
+ return par;
}
}
- private void expandSystemDirectory(IFileStore fileStore) {
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- IViewPart remoteSystemView = workbenchPage.findView("org.eclipse.rse.ui.view.systemView");
- if (remoteSystemView == null) {
- try {
- remoteSystemView = workbenchPage.showView("org.eclipse.rse.ui.view.systemView");
- } catch (PartInitException e) {
- ForgeUIPlugin.log(e);
- }
- }
- if (remoteSystemView != null) {
- expandInRemoteSystemView(remoteSystemView, fileStore);
- }
- }
-
- private void expandWorkspaceDirectory(IContainer container) {
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- if (workbenchPage != null) {
- IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
- if (projectExplorer != null && projectExplorer instanceof CommonNavigator) {
- expandInProjectExplorer((CommonNavigator)projectExplorer, container);
- }
- IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer == null && projectExplorer == null) {
- try {
- packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- } catch (PartInitException e) {
- ForgeUIPlugin.log(e);
- }
- }
- if (packageExplorer != null) {
- expandInPackageExplorer(packageExplorer, container);
- }
- }
- }
-
- private void openFileInEditor(IFileStore fileStore) {
- try {
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- if (workbenchPage != null) {
- IDE.openEditorOnFileStore(workbenchPage, fileStore);
- }
- } catch (PartInitException e) {
- ForgeUIPlugin.log(e);
- }
- }
-
- private void expandInProjectExplorer(CommonNavigator projectExplorer, IContainer container) {
- projectExplorer.selectReveal(new StructuredSelection(container));
- TreeViewer treeViewer = projectExplorer.getCommonViewer();
- treeViewer.expandToLevel(container, 1);
- }
-
- private void expandInPackageExplorer(IViewPart packageExplorer, IContainer container) {
- if (packageExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(container));
- }
- Object treeViewer = packageExplorer.getAdapter(ISelectionProvider.class);
- if (treeViewer != null && treeViewer instanceof TreeViewer) {
- ((TreeViewer)treeViewer).expandToLevel(JavaCore.create(container), 1);
- }
- }
-
- private Viewer getViewer(IViewPart remoteSystemView) {
- if (remoteSystemView instanceof IRSEViewPart) {
- return ((IRSEViewPart)remoteSystemView).getRSEViewer();
- } else {
- return null;
- }
- }
-
- private ArrayList<String> createSegmentNames(IFileStore fileStore) {
- ArrayList<String> result = new ArrayList<String>();
- while (fileStore.getParent() != null) {
- result.add(0, fileStore.getName());
- fileStore = fileStore.getParent();
- }
- result.add(0, "/");
- result.add(0, "Root");
- result.add(0, "Local Files");
- result.add(0, "Local");
- return result;
- }
-
- private void expandInRemoteSystemView(
- IViewPart remoteSystemView,
- IFileStore fileStore) {
- Viewer viewer = getViewer(remoteSystemView);
- Object input = viewer.getInput();
- ArrayList<String> names = createSegmentNames(fileStore);
- ArrayList<Object> treeSegments = new ArrayList<Object>();
- for (String name : names) {
- if (input != null && input instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(input);
- for (Object object : adapter.getChildren((IAdaptable)input, null)) {
- if (object instanceof IAdaptable) {
- adapter = SystemAdapterHelpers.getViewAdapter(object);
- if (name.equals(adapter.getText(object))) {
- input = object;
- treeSegments.add(input);
- break;
- }
- }
- }
- } else {
- treeSegments.clear();
- break;
- }
- }
- TreePath treePath = new TreePath(treeSegments.toArray());
- viewer.setSelection(new StructuredSelection(treePath));
- if (viewer instanceof TreeViewer) {
- ((TreeViewer)viewer).expandToLevel(treePath, 1);
-
- }
- }
-
}
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PersistencePostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PersistencePostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PersistencePostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,5 +1,7 @@
package org.jboss.tools.forge.ui.console;
+import java.util.Map;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -13,17 +15,16 @@
public class PersistencePostProcessor implements ForgeCommandPostProcessor {
@Override
- public void postProcessCommand(String command, String output) {
+ public void postProcess(Map<String, String> commandDetails) {
+ String command = commandDetails.get("ec");
if (command.indexOf("setup") != -1) {
- postProcessPersistenceSetup(command, output);
+ postProcessPersistenceSetup(commandDetails);
}
}
- private void postProcessPersistenceSetup(final String command, final String output) {
- IProject project = ForgeCommandPostProcessorHelper.getProject(command);
+ private void postProcessPersistenceSetup(Map<String, String> commandDetails) {
+ IProject project = ForgeCommandPostProcessorHelper.getProject(commandDetails.get("cpn"));
if (project == null) return;
- int index = output.lastIndexOf("***SUCCESS***");
- if (index == -1) return;
try {
IFile file = project.getFile("/src/main/resources/META-INF/persistence.xml");
if (file == null) return;
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PickUpPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PickUpPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PickUpPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,59 +1,174 @@
package org.jboss.tools.forge.ui.console;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
+import java.util.ArrayList;
+import java.util.Map;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.rse.ui.view.IRSEViewPart;
+import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
+import org.eclipse.rse.ui.view.SystemAdapterHelpers;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.navigator.CommonNavigator;
import org.eclipse.ui.part.ISetSelectionTarget;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
+
public class PickUpPostProcessor implements ForgeCommandPostProcessor {
-
+
+ protected String getResourceToOpen(Map<String, String> commandDetails) {
+ return commandDetails.get("crn");
+ }
+
@Override
- public void postProcessCommand(final String command, final String output) {
- IProject project = ForgeCommandPostProcessorHelper.getProject(command);
- if (project == null) return;
- int index = output.lastIndexOf("Picked up type <JavaResource>: ");
- if (index == -1) return;
- if (index + 31 > output.length() -1) return;
- String entityName = output.substring(index + 31, output.length() - 1).replace('.', '/');
- try {
- IFile file = project.getFile("/src/main/java/" + entityName + ".java");
- if (file == null) return;
- Object objectToSelect = file;
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- if (workbenchPage == null) return;
- IDE.openEditor(workbenchPage, file);
- IJavaElement javaElement = JavaCore.create(file);
- if (javaElement != null && javaElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
- try {
- objectToSelect = ((ICompilationUnit)javaElement).getTypes()[0];
- } catch (JavaModelException e) {
- ForgeUIPlugin.log(e);
- }
+ public void postProcess(Map<String, String> commandDetails) {
+ String crn = getResourceToOpen(commandDetails);
+ if (crn == null) return;
+ IPath path = new Path(crn);
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(crn));
+ IFileInfo fileInfo = fileStore.fetchInfo();
+ if (!fileInfo.exists()) return;
+ if (fileInfo.isDirectory()) {
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(path);
+ if (container != null) {
+ expandWorkspaceDirectory(container);
+ } else {
+ expandSystemDirectory(fileStore);
}
+ } else {
+ openFileInEditor(fileStore);
+ }
+ }
+
+ private void expandSystemDirectory(IFileStore fileStore) {
+ IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
+ IViewPart remoteSystemView = workbenchPage.findView("org.eclipse.rse.ui.view.systemView");
+ if (remoteSystemView == null) {
+ try {
+ remoteSystemView = workbenchPage.showView("org.eclipse.rse.ui.view.systemView");
+ } catch (PartInitException e) {
+ ForgeUIPlugin.log(e);
+ }
+ }
+ if (remoteSystemView != null) {
+ expandInRemoteSystemView(remoteSystemView, fileStore);
+ }
+ }
+
+ private void expandWorkspaceDirectory(IContainer container) {
+ IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
+ if (workbenchPage != null) {
IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
- if (projectExplorer != null && projectExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)projectExplorer).selectReveal(new StructuredSelection(objectToSelect));
+ if (projectExplorer != null && projectExplorer instanceof CommonNavigator) {
+ expandInProjectExplorer((CommonNavigator)projectExplorer, container);
}
IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
if (packageExplorer == null && projectExplorer == null) {
- packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
+ try {
+ packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
+ } catch (PartInitException e) {
+ ForgeUIPlugin.log(e);
+ }
}
- if (packageExplorer != null && packageExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
+ if (packageExplorer != null) {
+ expandInPackageExplorer(packageExplorer, container);
}
+ }
+ }
+
+ private void openFileInEditor(IFileStore fileStore) {
+ try {
+ IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
+ if (workbenchPage != null) {
+ IDE.openEditorOnFileStore(workbenchPage, fileStore);
+ }
} catch (PartInitException e) {
ForgeUIPlugin.log(e);
}
}
-
+ private void expandInProjectExplorer(CommonNavigator projectExplorer, IContainer container) {
+ projectExplorer.selectReveal(new StructuredSelection(container));
+ TreeViewer treeViewer = projectExplorer.getCommonViewer();
+ treeViewer.expandToLevel(container, 1);
+ }
+
+ private void expandInPackageExplorer(IViewPart packageExplorer, IContainer container) {
+ if (packageExplorer instanceof ISetSelectionTarget) {
+ ((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(container));
+ }
+ Object treeViewer = packageExplorer.getAdapter(ISelectionProvider.class);
+ if (treeViewer != null && treeViewer instanceof TreeViewer) {
+ ((TreeViewer)treeViewer).expandToLevel(JavaCore.create(container), 1);
+ }
+ }
+
+ private Viewer getViewer(IViewPart remoteSystemView) {
+ if (remoteSystemView instanceof IRSEViewPart) {
+ return ((IRSEViewPart)remoteSystemView).getRSEViewer();
+ } else {
+ return null;
+ }
+ }
+
+ private ArrayList<String> createSegmentNames(IFileStore fileStore) {
+ ArrayList<String> result = new ArrayList<String>();
+ while (fileStore.getParent() != null) {
+ result.add(0, fileStore.getName());
+ fileStore = fileStore.getParent();
+ }
+ result.add(0, "/");
+ result.add(0, "Root");
+ result.add(0, "Local Files");
+ result.add(0, "Local");
+ return result;
+ }
+
+ private void expandInRemoteSystemView(
+ IViewPart remoteSystemView,
+ IFileStore fileStore) {
+ Viewer viewer = getViewer(remoteSystemView);
+ Object input = viewer.getInput();
+ ArrayList<String> names = createSegmentNames(fileStore);
+ ArrayList<Object> treeSegments = new ArrayList<Object>();
+ for (String name : names) {
+ if (input != null && input instanceof IAdaptable) {
+ ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(input);
+ for (Object object : adapter.getChildren((IAdaptable)input, null)) {
+ if (object instanceof IAdaptable) {
+ adapter = SystemAdapterHelpers.getViewAdapter(object);
+ if (name.equals(adapter.getText(object))) {
+ input = object;
+ treeSegments.add(input);
+ break;
+ }
+ }
+ }
+ } else {
+ treeSegments.clear();
+ break;
+ }
+ }
+ TreePath treePath = new TreePath(treeSegments.toArray());
+ viewer.setSelection(new StructuredSelection(treePath));
+ if (viewer instanceof TreeViewer) {
+ ((TreeViewer)viewer).expandToLevel(treePath, 1);
+
+ }
+ }
}
Deleted: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PrettyFacesPostProcessor.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PrettyFacesPostProcessor.java 2011-12-03 20:28:05 UTC (rev 36916)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PrettyFacesPostProcessor.java 2011-12-03 21:38:23 UTC (rev 36917)
@@ -1,52 +0,0 @@
-package org.jboss.tools.forge.ui.console;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.jboss.tools.forge.ui.ForgeUIPlugin;
-
-public class PrettyFacesPostProcessor implements ForgeCommandPostProcessor {
-
- @Override
- public void postProcessCommand(String command, String output) {
- IProject project = ForgeCommandPostProcessorHelper.getProject(command);
- int index = output.lastIndexOf("***SUCCESS*** Installed [com.ocpsoft.prettyfaces] successfully.");
- if (index == -1) return;
- String str = output.substring(0, index - 1);
- index = str.lastIndexOf("Wrote ");
- if (index == -1) return;
- if (index + 6 > str.length()) return;
- str = str.substring(index + 6);
- String projectLocation = project.getLocation().toString();
- index = str.lastIndexOf(projectLocation);
- if (index != 0) return;
- str = str.substring(projectLocation.length());
- IFile file = project.getFile(str);
- if (file == null) return;
- Object objectToSelect = file;
-// ProjectConfigurationUpdater.updateProject(project);
- try {
- IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
- IDE.openEditor(workbenchPage, file);
- IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
- if (projectExplorer != null && projectExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)projectExplorer).selectReveal(new StructuredSelection(objectToSelect));
- }
- IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer == null && projectExplorer == null) {
- packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- }
- if (packageExplorer != null && packageExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
- }
- } catch (PartInitException e) {
- ForgeUIPlugin.log(e);
- }
- }
-
-}
13 years, 1 month
JBoss Tools SVN: r36915 - in trunk/as/plugins: org.jboss.ide.eclipse.as.management.as71 and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2011-12-03 08:09:36 -0500 (Sat, 03 Dec 2011)
New Revision: 36915
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java
Log:
JBIDE-10325 fixed AS7 and AS71 code for checking deployments and make "run as" actually wait for the server to be available.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-12-03 03:01:43 UTC (rev 36914)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/internal/management/as7/AS7Manager.java 2011-12-03 13:09:36 UTC (rev 36915)
@@ -24,6 +24,9 @@
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.RESULT;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SERVER_STATE;
import static org.jboss.ide.eclipse.as.internal.management.as7.ModelDescriptionConstants.SHUTDOWN;
+import static org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.CHILD_TYPE;
+import static org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.DEPLOYMENT;
+import static org.jboss.ide.eclipse.as.internal.management.as71.ModelDescriptionConstants.READ_CHILDREN_NAMES_OPERATION;
import java.io.File;
import java.io.IOException;
@@ -142,7 +145,7 @@
* @throws JBoss7ManangerException
*/
public JBoss7DeploymentState getDeploymentStateSafe(String name) throws JBoss7ManangerException {
- if( hasDeployment(name)) {
+ if( !hasDeployment(name)) {
return JBoss7DeploymentState.NOT_FOUND;
}
return getDeploymentState(name);
@@ -287,8 +290,7 @@
private Set<String> getDeploymentNames() throws JBoss7ManangerException {
final ModelNode op = getEmptyOperation(READ_CHILDREN_NAMES_OPERATION, new ModelNode());
op.get(CHILD_TYPE).set(DEPLOYMENT);
- ModelNode response = execute(op);
- ModelNode result = response.get(RESULT);
+ ModelNode result = execute(op);
Set<String> deploymentNames = new HashSet<String>();
if (result.isDefined()) {
final List<ModelNode> deploymentNodes = result.asList();
@@ -300,4 +302,5 @@
}
+
}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71
___________________________________________________________________
Added: svn:ignore
+ bin
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-12-03 03:01:43 UTC (rev 36914)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-12-03 13:09:36 UTC (rev 36915)
@@ -186,7 +186,7 @@
* @throws JBoss7ManangerException
*/
public JBoss7DeploymentState getDeploymentStateSafe(String name) throws JBoss7ManangerException {
- if( hasDeployment(name)) {
+ if( !hasDeployment(name)) {
return JBoss7DeploymentState.NOT_FOUND;
}
return getDeploymentState(name);
@@ -331,8 +331,7 @@
private Set<String> getDeploymentNames() throws JBoss7ManangerException {
final ModelNode op = getEmptyOperation(READ_CHILDREN_NAMES_OPERATION, new ModelNode());
op.get(CHILD_TYPE).set(DEPLOYMENT);
- ModelNode response = execute(op);
- ModelNode result = response.get(RESULT);
+ ModelNode result = execute(op);
Set<String> deploymentNames = new HashSet<String>();
if (result.isDefined()) {
final List<ModelNode> deploymentNodes = result.asList();
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java 2011-12-03 03:01:43 UTC (rev 36914)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/JBTWebLaunchableClient.java 2011-12-03 13:09:36 UTC (rev 36915)
@@ -78,6 +78,8 @@
public IStatus launch2(IServer server, Object launchable, String launchMode, ILaunch launch) {
final JBTCustomHttpLaunchable http = (JBTCustomHttpLaunchable) launchable;
wait(server, http.getModule());
+
+ if(server.getServerState() == server.STATE_STARTED) {
Display.getDefault().asyncExec(new Runnable(){
public void run() {
try {
@@ -90,6 +92,10 @@
}
}
});
+ } else {
+ JBossServerUIPlugin.getDefault().getLog().log(
+ new Status(IStatus.WARNING, JBossServerUIPlugin.PLUGIN_ID, "Server stopped before before browser could be opened.", null));
+ }
return null;
}
@@ -101,6 +107,8 @@
}
}
+ //TODO: the waiting/timeout logic in here should be done for waitJMX too.
+ //TODO: should return true for succss or false if timeout so upper layer can report it.
protected void waitJBoss7(final IServer server, final IModule module) {
try {
JBoss7Server jbossServer = ServerConverter.checkedGetJBossServer(server, JBoss7Server.class);
@@ -108,22 +116,33 @@
IPath deployPath = PublishUtil.getDeployPath(new IModule[]{module}, jbossServer);
long time = new Date().getTime();
long endTime = time + getMaxDelay();
- while( new Date().getTime() < endTime ) {
- JBoss7DeploymentState state = service.getDeploymentState(
- new AS7ManagementDetails(server),
- deployPath.lastSegment());
- boolean done = (state == JBoss7DeploymentState.STARTED);
- if( done ) {
+ boolean waitedOnce = false;
+ while (new Date().getTime() < endTime) { // no need to keep doing this if timed out or server stopping/stopped but not sure how to avoid race condition.
+ AS7ManagementDetails details = new AS7ManagementDetails(server);
+ boolean done = false;
+ if (service.isRunning(details)) { // to avoid asking while server is starting up.
+ JBoss7DeploymentState state = service.getDeploymentState(
+ details, deployPath.lastSegment());
+ done = (state == JBoss7DeploymentState.STARTED);
+ }
+ if (done) {
return;
}
try {
+ if(!waitedOnce) {
+ JBossServerUIPlugin.log(new Status(IStatus.INFO, JBossServerUIPlugin.PLUGIN_ID, "Module " + module.getName() + " on " + server.getName() + " not ready to be shown in web browser. Waiting...", null));
+ }
+ waitedOnce = true;
Thread.sleep(2000);
- } catch(InterruptedException ie) {}
+ } catch (InterruptedException ie) {
+ }
}
} catch (Exception e) {
IStatus s = new Status(
- IStatus.WARNING, JBossServerCorePlugin.PLUGIN_ID,
- NLS.bind("Could not acquire the management service for this JBoss installation",
+ IStatus.WARNING,
+ JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(
+ "Error occurred while waiting for " + module.getName() + " to start on " + server.getName(),
server.getName()), e);
JBossServerUIPlugin.log(s.getMessage(), e);
}
13 years, 1 month
JBoss Tools SVN: r36914 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-02 22:01:43 -0500 (Fri, 02 Dec 2011)
New Revision: 36914
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java
Log:
JBIDE-10161
https://issues.jboss.org/browse/JBIDE-10161
Prevented full build if all changed files are derived.
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java 2011-12-03 00:34:34 UTC (rev 36913)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidatorManager.java 2011-12-03 03:01:43 UTC (rev 36914)
@@ -77,7 +77,7 @@
try {
validationContextManager.clearValidatedProjectsList();
Set<IFile> changedFiles = validationHelper.getChangedFiles();
- if(!changedFiles.isEmpty()) {
+ if(!changedFiles.isEmpty() || validationHelper.getURIs().length > 0) {
status = validate(changedFiles, validationHelper, reporter, rootProjects);
} else if(!validationContextManager.getRegisteredFiles().isEmpty()) {
validationContextManager.clearAllResourceLinks();
13 years, 1 month
JBoss Tools SVN: r36913 - trunk/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-12-02 19:34:34 -0500 (Fri, 02 Dec 2011)
New Revision: 36913
Modified:
trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
Log:
seems that we should be using image32, not image48 for an image that's 32x32px
Modified: trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-03 00:31:50 UTC (rev 36912)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-03 00:34:34 UTC (rev 36913)
@@ -11,7 +11,7 @@
Extra Plugins for JBoss Tools or JBoss Developer Studio
</description>
<icon
- image48="images/jbds_icon32.png">
+ image32="images/jbds_icon32.png">
</icon>
</certification>
<certification
@@ -22,7 +22,7 @@
Plugins for JBoss Tools or JBoss Developer Studio
</description>
<icon
- image48="images/jbosstools_icon32.png">
+ image32="images/jbosstools_icon32.png">
</icon>
</certification>
13 years, 1 month
JBoss Tools SVN: r36912 - in trunk/cdi/tests: org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigValidationTest/lib and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-12-02 19:31:50 -0500 (Fri, 02 Dec 2011)
New Revision: 36912
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/solder-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/solder-impl.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigValidationTest/lib/solder-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigValidationTest/lib/solder-impl.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/seam-persistence-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/seam-persistence.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/solder-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/solder-impl.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.faces.core.test/projects/SeamFacesTest/lib/seam-faces-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.faces.core.test/projects/SeamFacesTest/lib/seam-faces.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/lib/solder-api.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/lib/solder-impl.jar
Log:
https://issues.jboss.org/browse/JBIDE-10329 Upgrade Seam 3 test project to the latest Seam 3.1.0.CR1
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/solder-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigTest/lib/solder-impl.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigValidationTest/lib/solder-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.config.core.test/projects/CDIConfigValidationTest/lib/solder-impl.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/seam-persistence-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/seam-persistence.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/solder-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/lib/solder-impl.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.faces.core.test/projects/SeamFacesTest/lib/seam-faces-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.faces.core.test/projects/SeamFacesTest/lib/seam-faces.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/lib/solder-api.jar
===================================================================
(Binary files differ)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.solder.core.test/projects/CDISolderTest/lib/solder-impl.jar
===================================================================
(Binary files differ)
13 years, 1 month
JBoss Tools SVN: r36911 - trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-02 19:19:21 -0500 (Fri, 02 Dec 2011)
New Revision: 36911
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
Log:
JBIDE-10161
https://issues.jboss.org/browse/JBIDE-10161
Test added that derived resources are excluded from JBoss Tools validation.
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java 2011-12-03 00:18:52 UTC (rev 36910)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java 2011-12-03 00:19:21 UTC (rev 36911)
@@ -46,6 +46,10 @@
target.setDerived(true, null);
}
+ /**
+ * See JBIDE-10161
+ * @throws Exception
+ */
public void testValidationInDerived() throws Exception {
//Check first that original web.xml contains errors.
String path0 = "WebContent/WEB-INF/web.xml";
13 years, 1 month
JBoss Tools SVN: r36910 - in trunk/jst/tests/org.jboss.tools.jst.web.test: projects/testWebProject and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-02 19:18:52 -0500 (Fri, 02 Dec 2011)
New Revision: 36910
Added:
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web.xml
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/aFolder/
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/aFolder/WEB-INF/
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/target/m2e-wtp/web-resources/WEB-INF/
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebValidationTestSetup.java
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/.classpath
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebUtilTest.java
Log:
JBIDE-10161
https://issues.jboss.org/browse/JBIDE-10161
Test added that derived resources are excluded from JBoss Tools validation.
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/META-INF/MANIFEST.MF 2011-12-03 00:12:28 UTC (rev 36909)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/META-INF/MANIFEST.MF 2011-12-03 00:18:52 UTC (rev 36910)
@@ -4,11 +4,18 @@
Bundle-SymbolicName: org.jboss.tools.jst.web.test;singleton:=true
Bundle-Version: 3.3.0.qualifier
Require-Bundle: org.jboss.tools.jst.web,
+ org.jboss.tools.common.base.test,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.jboss.tools.common.el.core,
+ org.jboss.tools.jst.web.kb,
+ org.jboss.tools.common.validation,
org.junit,
org.jboss.tools.tests,
org.eclipse.jst.standard.schemas,
+ org.eclipse.wst.common.frameworks;bundle-version="1.2.0",
org.eclipse.ui,
- org.eclipse.wst.validation
+ org.eclipse.wst.validation;bundle-version="1.2.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Export-Package: org.jboss.tools.jst.web.test
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/.classpath
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/.classpath 2011-12-03 00:12:28 UTC (rev 36909)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/.classpath 2011-12-03 00:18:52 UTC (rev 36910)
@@ -1,16 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_20">
- <attributes>
- <attribute name="owner.project.facets" value="java"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 6.x Runtime">
- <attributes>
- <attribute name="owner.project.facets" value="jst.web"/>
- </attributes>
- </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
Added: trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web.xml (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web.xml 2011-12-03 00:18:52 UTC (rev 36910)
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>jsf</display-name>
+ <listener>
+ <listener-class>abc</listener-class>
+ </listener>
+</web-app>
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java 2011-12-03 00:12:28 UTC (rev 36909)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java 2011-12-03 00:18:52 UTC (rev 36910)
@@ -16,19 +16,17 @@
import org.jboss.tools.test.util.ProjectImportTestSetup;
public class JstWebAllTests {
-
+ public static final String PLUGIN_ID = "org.jboss.tools.jst.web.test";
public static final String PROJECT_NAME = "testWebProject";
- private static final String PROJECT_PATH = "/projects/" + PROJECT_NAME;
+ public static final String PROJECT_PATH = "/projects/" + PROJECT_NAME;
public static Test suite() {
TestSuite suite = new TestSuite(JstWebAllTests.class.getName());
suite.addTestSuite(WebContentAssistProviderTest.class);
- suite.addTestSuite(BuilderTest.class);
- suite.addTest(new ProjectImportTestSetup(new TestSuite(
- WebUtilTest.class),
- "org.jboss.tools.jst.web.test", //$NON-NLS-1$
- PROJECT_PATH, //$NON-NLS-1$
- PROJECT_NAME));
+// suite.addTestSuite(BuilderTest.class);
+ suite.addTest(new WebValidationTestSetup(new TestSuite(
+ WebUtilTest.class,
+ WebXMLValidationTest.class)));
return suite;
}
}
\ No newline at end of file
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebUtilTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebUtilTest.java 2011-12-03 00:12:28 UTC (rev 36909)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebUtilTest.java 2011-12-03 00:18:52 UTC (rev 36910)
@@ -14,8 +14,12 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.common.base.test.validation.TestUtil;
import org.jboss.tools.jst.web.WebUtils;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+import org.jboss.tools.test.util.ResourcesUtils;
/**
* @author Alexey Kazakov
@@ -29,11 +33,29 @@
*/
@Override
protected void setUp() throws Exception {
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(JstWebAllTests.PROJECT_NAME);
- IResource target = project.getFolder("target");
- target.setDerived(true, null);
+ project = getTestProject();
}
+ public IProject getTestProject() {
+ if(project==null) {
+ try {
+ project = findTestProject();
+ if(project==null || !project.exists()) {
+ project = ResourcesUtils.importProject(JstWebAllTests.PLUGIN_ID, JstWebAllTests.PROJECT_PATH);
+ TestUtil._waitForValidation(project);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import CDI test project: " + e.getMessage());
+ }
+ }
+ return project;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(JstWebAllTests.PROJECT_NAME);
+ }
+
/**
* See https://issues.jboss.org/browse/JBIDE-9766
* @throws Exception
Added: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebValidationTestSetup.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebValidationTestSetup.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebValidationTestSetup.java 2011-12-03 00:18:52 UTC (rev 36910)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.test;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.common.base.test.validation.TestUtil;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class WebValidationTestSetup extends TestSetup {
+
+ protected IProject project;
+
+ public WebValidationTestSetup(Test test) {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ project = getTestProject();
+
+ boolean state = ResourcesUtils.setBuildAutomatically(false);
+ IResource target = project.getFolder("target");
+ target.setDerived(true, null);
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ TestUtil._waitForValidation(project);
+ ResourcesUtils.setBuildAutomatically(state);
+ }
+
+ public IProject getTestProject() {
+ if(project==null) {
+ try {
+ project = findTestProject();
+ if(project==null || !project.exists()) {
+ project = ResourcesUtils.importProject(JstWebAllTests.PLUGIN_ID, JstWebAllTests.PROJECT_PATH);
+ TestUtil._waitForValidation(project);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import CDI test project: " + e.getMessage());
+ }
+ }
+ return project;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(JstWebAllTests.PROJECT_NAME);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ project.delete(true, true, null);
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebValidationTestSetup.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java 2011-12-03 00:18:52 UTC (rev 36910)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.base.test.validation.TestUtil;
+import org.jboss.tools.common.validation.ValidatorManager;
+import org.jboss.tools.jst.web.WebUtils;
+import org.jboss.tools.jst.web.validation.WebXMLCoreValidator;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class WebXMLValidationTest extends TestCase {
+
+ private IProject project;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ project = ProjectImportTestSetup.loadProject(JstWebAllTests.PROJECT_NAME);
+ IResource target = project.getFolder("target");
+ target.setDerived(true, null);
+ }
+
+ public void testValidationInDerived() throws Exception {
+ //Check first that original web.xml contains errors.
+ String path0 = "WebContent/WEB-INF/web.xml";
+ IFile webxml = project.getFile(path0);
+ assertTrue(webxml.exists());
+ IMarker[] markers = webxml.findMarkers(WebXMLCoreValidator.PROBLEM_TYPE, false, IResource.DEPTH_ZERO);
+ assertTrue(markers.length > 0);
+
+ //Now we will copy that original web.xml to different folders and check incremental validation.
+
+ //Check that file added to a non-derived folder is validated incrementally.
+ String path1 = "aFolder/WEB-INF/web.xml";
+ IFile webxml1 = project.getFile(path1);
+ replaceFile(project, path0, path1);
+ markers = webxml1.findMarkers(WebXMLCoreValidator.PROBLEM_TYPE, false, IResource.DEPTH_ZERO);
+ assertTrue(markers.length > 0);
+ for (IMarker m: markers) {
+ System.out.println(m.getAttribute(IMarker.MESSAGE));
+ }
+
+ //Check that added to a derived folder, file will be skipped at incremental validation.
+ String path2 = "target/m2e-wtp/web-resources/WEB-INF/web.xml";
+ IFile webxml2 = project.getFile(path2);
+ replaceFile(project, path0, path2);
+ markers = webxml2.findMarkers(WebXMLCoreValidator.PROBLEM_TYPE, false, IResource.DEPTH_ZERO);
+ assertTrue(markers.length == 0);
+ }
+
+ public static void replaceFile(IProject project, String sourcePath, String targetPath) throws CoreException {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ try {
+ IFile target = project.getFile(new Path(targetPath));
+ IFile source = project.getFile(new Path(sourcePath));
+ assertTrue(source.exists());
+ ValidatorManager.setStatus(ValidatorManager.RUNNING);
+ if(!target.exists()) {
+ target.create(source.getContents(), true, new NullProgressMonitor());
+ } else {
+ target.setContents(source.getContents(), true, false, new NullProgressMonitor());
+ }
+ TestUtil.validate(target);
+ } finally {
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ JobUtils.waitForIdle();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebXMLValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 1 month