JBoss Tools SVN: r36253 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-11-09 14:51:30 -0500 (Wed, 09 Nov 2011)
New Revision: 36253
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing https://issues.jboss.org/browse/JBIDE-9940
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-11-09 19:41:22 UTC (rev 36252)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-11-09 19:51:30 UTC (rev 36253)
@@ -12,6 +12,8 @@
import java.util.List;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
@@ -19,6 +21,7 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.cdi.ui.marker.AddQualifiersToBeanProcessor;
public abstract class AbstractModifyInjectionPointWizard extends RefactoringWizard {
@@ -27,6 +30,14 @@
}
public boolean showWizard() {
+ if(!CDIUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true))
+ return false;
+
+ try {
+ Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(this);
try {
13 years, 1 month
JBoss Tools SVN: r36252 - in trunk/forge/plugins: org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-11-09 14:41:22 -0500 (Wed, 09 Nov 2011)
New Revision: 36252
Added:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/PomFileModifiedHandler.java
Modified:
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/importer/ProjectConfigurationUpdater.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/PrettyFacesPostProcessor.java
trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
Log:
JBIDE-10036:
- Run 'Update Project Configuration' whenever the pom.xml changes
- Refresh workspace after each Forge 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-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime/META-INF/MANIFEST.MF 2011-11-09 19:41:22 UTC (rev 36252)
@@ -11,6 +11,7 @@
javax.inject,
org.jboss.forge.project,
org.jboss.forge.resources,
+ org.jboss.forge.resources.events,
org.jboss.forge.shell,
org.jboss.forge.shell.command,
org.jboss.forge.shell.events,
Added: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/PomFileModifiedHandler.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/PomFileModifiedHandler.java (rev 0)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/PomFileModifiedHandler.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -0,0 +1,26 @@
+package org.jboss.tools.forge.runtime.ext;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.jboss.forge.resources.events.ResourceEvent;
+import org.jboss.forge.shell.Shell;
+
+public class PomFileModifiedHandler {
+
+ private static final String ESCAPE = new String(new char[] { 27, '%'} );
+
+ @Inject
+ private Shell shell;
+
+ public void handleResourceChanged(@Observes ResourceEvent event) {
+ if (event.getResource() != null && "pom.xml".equals(event.getResource().getName())) {
+ sendEscaped("POM File Modified: " + event.getResource().getParent().getName());
+ }
+ }
+
+ private void sendEscaped(String str) {
+ shell.print(ESCAPE + str + ESCAPE);
+ }
+
+}
Property changes on: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org/jboss/tools/forge/runtime/ext/PomFileModifiedHandler.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/importer/ProjectConfigurationUpdater.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/importer/ProjectConfigurationUpdater.java 2011-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/importer/ProjectConfigurationUpdater.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -11,14 +11,8 @@
public class ProjectConfigurationUpdater {
- private IProject project;
-
- public ProjectConfigurationUpdater(IProject project) {
- this.project = project;
- }
-
- public void updateProject() {
- Job job = new WorkspaceJob("Importing Forge project") {
+ public static void updateProject(final IProject project) {
+ Job job = new WorkspaceJob("Updating project configuration") {
public IStatus runInWorkspace(IProgressMonitor monitor) {
try {
MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(
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-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeCommandProcessor.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -40,7 +40,14 @@
public void stopCurrentCommand() {
if (currentCommand != null) {
- postProcessCommand(currentCommand, buffer.toString());
+ final String command = currentCommand;
+ final String output = buffer.toString();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ postProcessCurrentCommand(command, output);
+ }
+ });
}
currentCommand = null;
}
@@ -51,25 +58,21 @@
}
}
- private void postProcessCommand(final String command, final String output) {
- String mainCommand = command;
+ private void postProcessCurrentCommand(String currentCommand, String output) {
+ if (currentCommand == null) return;
+ String mainCommand = currentCommand;
int i = mainCommand.indexOf(' ');
if (i != -1) {
- mainCommand = command.substring(0, i);
+ mainCommand = currentCommand.substring(0, i);
}
- final ForgeCommandPostProcessor postProcessor = getPostProcessors().get(mainCommand);
+ refreshWorkspace();
+ ForgeCommandPostProcessor postProcessor = getPostProcessors().get(mainCommand);
if (postProcessor != null) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- refreshWorkspace();
- postProcessor.postProcessCommand(command, output);
- showForgeConsole();
- }
- });
+ postProcessor.postProcessCommand(mainCommand, output);
}
+ showForgeConsole();
}
-
+
private void refreshWorkspace() {
try {
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
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-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/ForgeTextViewer.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -3,6 +3,8 @@
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;
@@ -22,6 +24,7 @@
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 {
@@ -185,6 +188,11 @@
commandProcessor.stopCurrentCommand();
// } else {
// System.out.println("unhandled hidden output: " + str);
+ } else if (str.startsWith("POM File Modified: ")) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(str.substring(19));
+ if (project != null) {
+ ProjectConfigurationUpdater.updateProject(project);
+ }
}
}
};
Modified: 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-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/console/PrettyFacesPostProcessor.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -8,7 +8,6 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.ISetSelectionTarget;
-import org.jboss.tools.forge.importer.ProjectConfigurationUpdater;
import org.jboss.tools.forge.ui.ForgeUIPlugin;
public class PrettyFacesPostProcessor implements ForgeCommandPostProcessor {
@@ -30,7 +29,7 @@
IFile file = project.getFile(str);
if (file == null) return;
Object objectToSelect = file;
- new ProjectConfigurationUpdater(project).updateProject();
+// ProjectConfigurationUpdater.updateProject(project);
try {
IWorkbenchPage workbenchPage = ForgeCommandPostProcessorHelper.getActiveWorkbenchPage();
IDE.openEditor(workbenchPage, file);
Modified: trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-11-09 17:23:47 UTC (rev 36251)
+++ trunk/forge/plugins/org.jboss.tools.forge.ui/src/org/jboss/tools/forge/ui/part/ForgeView.java 2011-11-09 19:41:22 UTC (rev 36252)
@@ -191,7 +191,7 @@
Thread waitThread = new Thread(new Runnable() {
@Override
public void run() {
- while (!ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
+ while (runtime != null && !ForgeRuntime.STATE_RUNNING.equals(runtime.getState())) {
try {
Thread.sleep(1000);
updateNonRunningPage();
13 years, 1 month
JBoss Tools SVN: r36251 - workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2011-11-09 12:23:47 -0500 (Wed, 09 Nov 2011)
New Revision: 36251
Modified:
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java
workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java
Log:
https://issues.jboss.org/browse/JBIDE-9539 : Browsersim app for testing mobile/desktop web apps
- implemented load/save devices list to a file (now it is just API, not connected with the UI)
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-09 15:00:39 UTC (rev 36250)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/BrowserSim.java 2011-11-09 17:23:47 UTC (rev 36251)
@@ -323,7 +323,7 @@
if (selectedDeviceIndex < 0) {
selectedDeviceIndex = 0;
}
- devicesList.setCurrentDeviceIndex(selectedDeviceIndex);
+ devicesList.setSelectedDeviceIndex(selectedDeviceIndex);
devicesList.notifyObservers();
}
};
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java 2011-11-09 15:00:39 UTC (rev 36250)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesList.java 2011-11-09 17:23:47 UTC (rev 36251)
@@ -14,17 +14,17 @@
import java.util.Observable;
/**
- * An unmodifiable list of {@link Device}s, with modifiable {@link #currentDeviceIndex}.
+ * An unmodifiable list of {@link Device}s, with modifiable {@link #selectedDeviceIndex}.
*
* @author Yahor Radtsevich (yradtsevich)
*/
public class DevicesList extends Observable {
private List<Device> devices;
- private int currentDeviceIndex;
+ private int selectedDeviceIndex;
- public DevicesList(List<Device> devices, int currentDeviceIndex) {
+ public DevicesList(List<Device> devices, int selectedDeviceIndex) {
this.devices = devices;
- this.currentDeviceIndex = currentDeviceIndex;
+ this.selectedDeviceIndex = selectedDeviceIndex;
}
public List<Device> getDevices() {
@@ -32,12 +32,12 @@
}
public int getSelectedDeviceIndex() {
- return currentDeviceIndex;
+ return selectedDeviceIndex;
}
- public void setCurrentDeviceIndex(int currentDeviceIndex) {
- if (this.currentDeviceIndex != currentDeviceIndex) {
- this.currentDeviceIndex = currentDeviceIndex;
+ public void setSelectedDeviceIndex(int currentDeviceIndex) {
+ if (this.selectedDeviceIndex != currentDeviceIndex) {
+ this.selectedDeviceIndex = currentDeviceIndex;
setChanged();
}
}
Modified: workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java
===================================================================
--- workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java 2011-11-09 15:00:39 UTC (rev 36250)
+++ workspace/yradtsevich/browsersim/swt-webkit-browsersim/org.jboss.tools.browsersim/src/org/jboss/tools/browsersim/DevicesManager.java 2011-11-09 17:23:47 UTC (rev 36251)
@@ -10,9 +10,17 @@
******************************************************************************/
package org.jboss.tools.browsersim;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
@@ -53,4 +61,92 @@
return new DevicesList(devices, 0);
}
+
+ public static String encode(String string) {
+ return string.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t");
+ }
+
+ public static String decode(String string) {
+ StringBuilder result = new StringBuilder();
+
+ int i = 0;
+ while (i < string.length() - 1) {
+ char c0 = string.charAt(i);
+ if (c0 == '\\') {
+ char c1 = string.charAt(i + 1);
+ switch (c1) {
+ case '\\':
+ result.append('\\');
+ i++;
+ break;
+ case 'n':
+ result.append('\n');
+ i++;
+ break;
+ case 't':
+ result.append('\t');
+ i++;
+ break;
+ default:
+ result.append(c0);
+ break;
+ }
+ }
+ i++;
+ }
+
+ if (i < string.length()) {
+ result.append(string.charAt(i));
+ }
+
+ return result.toString();
+ }
+
+ public static void saveDevicesList(DevicesList devicesList, File file) throws IOException {
+ BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+
+ writer.write(String.valueOf(devicesList.getSelectedDeviceIndex()));
+ writer.write('\n');
+
+ for (Device device : devicesList.getDevices()) {
+ writer.write( encode(device.getName() ));
+ writer.write('\t');
+ writer.write(encode( String.valueOf(device.getWidth()) ));
+ writer.write('\t');
+ writer.write(encode( String.valueOf(device.getHeight()) ));
+ writer.write('\t');
+ writer.write( encode(device.getUserAgent() ));
+ writer.write('\n');
+ }
+
+ writer.close();
+ }
+
+ public static DevicesList loadDevicesList(File file) throws IOException {
+ BufferedReader reader = new BufferedReader(new FileReader(file));
+
+ String nextLine = reader.readLine();
+ int selectedDeviceIndex = 0;
+ if (nextLine != null) {
+ selectedDeviceIndex = Integer.parseInt(nextLine);
+ }
+ Pattern devicePattern = Pattern.compile("(.*)\\t([0-9]*)\\t([0-9]*)\\t(.*)");
+
+ List<Device> devices = new ArrayList<Device>();
+ while ((nextLine = reader.readLine()) != null) {
+ Matcher deviceMatcher = devicePattern.matcher(nextLine);
+ if (deviceMatcher.matches()) {
+ devices.add(new Device(
+ decode(deviceMatcher.group(1)),
+ Integer.parseInt(deviceMatcher.group(2)),
+ Integer.parseInt(deviceMatcher.group(3)),
+ decode(deviceMatcher.group(4))
+ ));
+ }
+ }
+
+ reader.close();
+
+ return new DevicesList(devices, selectedDeviceIndex);
+ }
}
13 years, 1 month
JBoss Tools SVN: r36250 - in trunk/maven/plugins: org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-09 10:00:39 -0500 (Wed, 09 Nov 2011)
New Revision: 36250
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/messages.properties
Log:
JBIDE-10037 : tweaked refresh hierarchy logic.
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2011-11-09 14:04:24 UTC (rev 36249)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2011-11-09 15:00:39 UTC (rev 36250)
@@ -1,11 +1,11 @@
package org.jboss.tools.maven.core;
import java.io.File;
-import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
-import org.apache.maven.project.MavenProject;
-import org.eclipse.core.internal.resources.Project;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -14,7 +14,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.JavaCore;
/**
* A utility class for Eclipse Projects.
@@ -40,20 +39,29 @@
try {
int count = 0;
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- final IProject[] projects = root.getProjects();
+ final List<IProject> projects = new ArrayList<IProject>(Arrays.asList(root.getProjects()));
+
final IPath rootLocation = root.getLocation();
IPath basedirPath = new Path(basedir.getAbsolutePath());
- while(basedirPath.matchingFirstSegments(rootLocation) > 0) {
- for(IProject project : projects) {
+ while(!rootLocation.equals(basedirPath) && rootLocation.isPrefixOf(basedirPath)) {
+ Iterator<IProject> ite = projects.iterator();
+
+ // In case of maven module projects, root.findContainersForLocationURI(...) would return an IFolder
+ // instead of an IProject. So we manually loop through all projects and test their path against the
+ // current basedirPath. Refreshed projects will be removed from the list for subsequent checks
+ while(ite.hasNext()) {
+ IProject project = ite.next();
final IPath projectLocation = project.getLocation();
- if(projectLocation.equals(basedirPath) && project.isOpen()) {
+ if(projectLocation.equals(basedirPath) && project.isAccessible()) {
project.refreshLocal(refreshDepth, monitor);
count++;
+ ite.remove();
break;
}
}
basedirPath = basedirPath.removeLastSegments(1);
}
+
return count;
} finally {
monitor.done();
Modified: trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-09 14:04:24 UTC (rev 36249)
+++ trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-09 15:00:39 UTC (rev 36250)
@@ -10,18 +10,13 @@
************************************************************************************/
package org.jboss.tools.maven.jaxrs.configurators;
-import java.io.File;
-
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
@@ -134,7 +129,8 @@
if (facetVersion != null) {
IStatus status = facetVersion.getConstraint().check(fproj.getProjectFacets());
if (status.isOK()) {
- // refreshing the project hierarchy to make sure that Eclipse "sees" the .settings folder and file, to be able to add the JAX-RS Facet
+ // refreshing the project hierarchy to make sure that Eclipse "sees" the .settings folder and file,
+ // to be able to add the JAX-RS Facet. This only occurs if the projects are created via the project example UI.
// see https://issues.jboss.org/browse/JBIDE-10037
ProjectUtil.refreshHierarchy(mavenProject.getBasedir(), IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
IDataModel model = createJaxRsDataModel(fproj,facetVersion);
Modified: trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/messages.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/messages.properties 2011-11-09 14:04:24 UTC (rev 36249)
+++ trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/messages.properties 2011-11-09 15:00:39 UTC (rev 36250)
@@ -1 +1 @@
-JaxrsProjectConfigurator_The_project_does_not_contain_required_facets=The {0} project does not contain the Dynamic Web Module facet or the EJB Module facet.
+JaxrsProjectConfigurator_The_project_does_not_contain_required_facets=The {0} project does not contain the Dynamic Web Module facet or the EJB Module facet required to enable JAX-RS support.
13 years, 1 month
JBoss Tools SVN: r36249 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-11-09 09:04:24 -0500 (Wed, 09 Nov 2011)
New Revision: 36249
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9975 - Put the URL into quotes
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-11-09 12:12:15 UTC (rev 36248)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-11-09 14:04:24 UTC (rev 36249)
@@ -78,8 +78,6 @@
public static String FILE_PROTOCOL = "file:"; //$NON-NLS-1$
public static String HTTP_PROTOCOL = "http:"; //$NON-NLS-1$
public static String SLASH = "/"; //$NON-NLS-1$
- public static final String[] REPLACED_CHARACTERS_REGEXP =
- new String[] {"\\(", "\\)", "'", "\"", Constants.WHITE_SPACE}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
/**
* Returns CSS style declaration corresponding to the given {@code element}.
@@ -436,7 +434,7 @@
file = (IFile) vii.getStorage();
}
for (int i = 1; i < urls.length; i++) {
- urls[i] = updateURLItem(urls[i]);
+ urls[i] = removeQuotesUpdate(urls[i]);
String[] urlParts = splitURL(urls[i]);
if (urlParts == null) {
continue;
@@ -463,7 +461,7 @@
return value;
}
for (int i = 1; i < urls.length; i++) {
- urls[i] = updateURLItem(urls[i]);
+ urls[i] = removeQuotesUpdate(urls[i]);
String[] urlParts = splitURL(urls[i]);
if (urlParts == null) {
continue;
@@ -503,7 +501,7 @@
return res;
}
- private static String updateURLItem(String url) {
+ private static String removeQuotesUpdate(String url) {
url = url.replace(SINGLE_QUOTE_STRING, EMPTY_STRING);
url = url.replace(QUOTE_STRING, EMPTY_STRING);
url = ATTR_URL + url;
@@ -769,9 +767,11 @@
try {
uri = new URI(resolvedUrl);
} catch (URISyntaxException e) {
- // here we process user input, and when user enter url, there possible that we will not be able parse it.
- // so we just ignore this.
- // VpePlugin.getDefault().logWarning("Error in parsiong URI string", e); //$NON-NLS-1$
+ /*
+ * here we process user input, and when user enter url,
+ * there possible that we will not be able parse it.
+ * So we just ignore this.
+ */
}
if (uri == null || !uri.isAbsolute()) {
String decodedUrl = decodeUrl(resolvedUrl);
@@ -788,15 +788,10 @@
}
/*
* https://issues.jboss.org/browse/JBIDE-9975
- * Accompany escaped symbols with "\"
- * Now all the URL string will be updated.
+ * Put the URL into quotes.
+ * It's default xulrunner behavior.
*/
- String n = null;
- for (String str : REPLACED_CHARACTERS_REGEXP) {
- n = "\\\\"+str.replaceAll("\\\\", Constants.EMPTY); //$NON-NLS-1$ //$NON-NLS-2$
- resolvedUrl = resolvedUrl.replaceAll(str, n);
- }
- return resolvedUrl;
+ return QUOTE_STRING + resolvedUrl + QUOTE_STRING;
}
private static String pathToUrl(IPath location) {
13 years, 1 month
JBoss Tools SVN: r36248 - trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-09 07:12:15 -0500 (Wed, 09 Nov 2011)
New Revision: 36248
Modified:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java
Log:
Don't display profiles input text if no profiles are availables
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java 2011-11-09 11:59:14 UTC (rev 36247)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/SelectProfilesDialog.java 2011-11-09 12:12:15 UTC (rev 36248)
@@ -116,6 +116,7 @@
setTitle(Messages.SelectProfilesDialog_Maven_profile_selection);
String text;
+ boolean hasProfiles = !sharedProfiles.isEmpty();
if (facade == null) {
text = NLS.bind(Messages.SelectProfilesDialog_Select_active_profiles_for_selected_projects,
facades.size()
@@ -124,13 +125,12 @@
text = NLS.bind(
Messages.SelectProfilesDialog_Select_the_active_Maven_profiles,
facade.getProject().getName());
-
- displayProfilesAsText(container);
+ if (hasProfiles) {
+ displayProfilesAsText(container);
+ }
}
setMessage(text);
- boolean hasProfiles = !sharedProfiles.isEmpty();
-
if (hasProfiles && facade == null) {
displayWarning(container);
}
13 years, 1 month
JBoss Tools SVN: r36247 - in branches/dead/hibernatetools-multiversion2/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-11-09 06:59:14 -0500 (Wed, 09 Nov 2011)
New Revision: 36247
Added:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypedNode.java
Modified:
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypeNode.java
Log:
Remove node dependencies from CriteriaEditorAction
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java 2011-11-09 11:42:53 UTC (rev 36246)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/BaseNode.java 2011-11-09 11:59:14 UTC (rev 36247)
@@ -28,6 +28,7 @@
import javax.swing.tree.TreeNode;
+import org.eclipse.osgi.util.NLS;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.execution.ExecutionContext;
@@ -98,6 +99,14 @@
}
public abstract String getHQL();
+
+ public String getCriteria(){
+ final String criteria = ".createCriteria({0})"; //$NON-NLS-1$
+ final String sess = "session"; //$NON-NLS-1$
+ String enName = getName().substring(getName().lastIndexOf('.') + 1);
+ String enCriteria = NLS.bind(criteria, enName + ".class"); //$NON-NLS-1$
+ return sess + enCriteria;
+ }
public String getName() {
return name;
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2011-11-09 11:42:53 UTC (rev 36246)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/PersistentCollectionNode.java 2011-11-09 11:59:14 UTC (rev 36247)
@@ -26,6 +26,7 @@
import javax.swing.tree.TreeNode;
+import org.eclipse.osgi.util.NLS;
import org.hibernate.EntityMode;
import org.hibernate.HibernateException;
import org.hibernate.console.ConsoleMessages;
@@ -38,7 +39,7 @@
* @author MAX
*
*/
-public class PersistentCollectionNode extends BaseNode {
+public class PersistentCollectionNode extends BaseNode implements TypedNode{
BaseNode virtualNode;
CollectionType type;
@@ -83,6 +84,33 @@
public String getHQL() {
return ""; //$NON-NLS-1$
}
+
+ @Override
+ public String getCriteria() {
+ final String criteria = ".createCriteria({0})"; //$NON-NLS-1$
+ final String alias = "\n.createCriteria(\"{0}\", \"{1}\")"; //$NON-NLS-1$
+ final String sess = "session"; //$NON-NLS-1$
+ String enName = "";//$NON-NLS-1$
+ String propCriteria = "";//$NON-NLS-1$
+ if (getName() != null){
+ if (getParent() instanceof BaseNode) {
+ BaseNode baseNodeParent = (BaseNode)getParent();
+ if (baseNodeParent instanceof TypedNode) {
+ TypedNode typedNodeParent = (TypedNode)baseNodeParent;
+ enName = typedNodeParent.getType().getName();
+ } else {
+ enName = baseNodeParent.getName();
+ }
+ enName = enName.substring(enName.lastIndexOf('.') + 1);
+ propCriteria = NLS.bind(alias, getName(), getName().charAt(0));
+ }
+ }
+ if ("".equals(enName)) { //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ String enCriteria = NLS.bind(criteria, enName + ".class"); //$NON-NLS-1$
+ return sess + enCriteria + propCriteria;
+ }
public TreeNode getChildAt(int childIndex) {
checkChildren();
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypeNode.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypeNode.java 2011-11-09 11:42:53 UTC (rev 36246)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypeNode.java 2011-11-09 11:59:14 UTC (rev 36247)
@@ -21,6 +21,7 @@
*/
package org.hibernate.console.node;
+import org.eclipse.osgi.util.NLS;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.type.Type;
@@ -28,7 +29,7 @@
* @author MAX
*
*/
-public class TypeNode extends ClassNode {
+public class TypeNode extends ClassNode implements TypedNode{
Type type;
public TypeNode(NodeFactory factory, BaseNode parent, Type type, ClassMetadata metadata, Object baseObject, boolean objectGraph) {
@@ -38,6 +39,32 @@
iconName = factory.getIconNameForType(type);
}
+ @Override
+ public String getCriteria() {
+ final String criteria = ".createCriteria({0})"; //$NON-NLS-1$
+ final String alias = "\n.createCriteria(\"{0}\", \"{1}\")"; //$NON-NLS-1$
+ final String sess = "session"; //$NON-NLS-1$
+ String enName = "";//$NON-NLS-1$
+ String propCriteria = "";//$NON-NLS-1$
+ if (getName() != null){
+ if (getParent() instanceof BaseNode) {
+ BaseNode baseNodeParent = (BaseNode)getParent();
+ if (baseNodeParent instanceof TypedNode) {
+ TypedNode typedNodeParent = (TypedNode)baseNodeParent;
+ enName = typedNodeParent.getType().getName();
+ } else {
+ enName = baseNodeParent.getName();
+ }
+ enName = enName.substring(enName.lastIndexOf('.') + 1);
+ propCriteria = NLS.bind(alias, getName(), getName().charAt(0));
+ }
+ }
+ if ("".equals(enName)) { //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ String enCriteria = NLS.bind(criteria, enName + ".class"); //$NON-NLS-1$
+ return sess + enCriteria + propCriteria;
+ }
public String renderLabel(boolean b) {
return super.renderLabel(b) + " : " + getLabel(type.getReturnedClass().getName(),b); //$NON-NLS-1$
Added: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypedNode.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypedNode.java (rev 0)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/TypedNode.java 2011-11-09 11:59:14 UTC (rev 36247)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console.node;
+
+import org.hibernate.type.Type;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface TypedNode {
+
+ public Type getType();
+
+}
Modified: branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java
===================================================================
--- branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java 2011-11-09 11:42:53 UTC (rev 36246)
+++ branches/dead/hibernatetools-multiversion2/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java 2011-11-09 11:59:14 UTC (rev 36247)
@@ -21,15 +21,11 @@
*/
package org.hibernate.eclipse.console.actions;
-import javax.swing.tree.TreeNode;
-
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.osgi.util.NLS;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
import org.hibernate.console.node.BaseNode;
-import org.hibernate.console.node.PersistentCollectionNode;
-import org.hibernate.console.node.TypeNode;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -97,41 +93,7 @@
}
}
} else if (node instanceof BaseNode) {
- String prName = null;
- TreeNode treeNodeParent = null;
- if (node instanceof TypeNode) {
- TypeNode typeNode = (TypeNode)node;
- prName = typeNode.getName();
- treeNodeParent = typeNode.getParent();
- }
- else if (node instanceof PersistentCollectionNode) {
- PersistentCollectionNode persistentCollectionNode = (PersistentCollectionNode)node;
- prName = persistentCollectionNode.getName();
- treeNodeParent = persistentCollectionNode.getParent();
- }
- else {
- BaseNode baseNode = (BaseNode)node;
- enName = baseNode.getName();
- enName = enName.substring(enName.lastIndexOf('.') + 1);
- }
- if (prName != null) {
- if (treeNodeParent instanceof BaseNode) {
- BaseNode baseNodeParent = (BaseNode)treeNodeParent;
- if (baseNodeParent instanceof TypeNode) {
- TypeNode typeNodeParent = (TypeNode)baseNodeParent;
- enName = typeNodeParent.getType().getName();
- }
- else if (baseNodeParent instanceof PersistentCollectionNode) {
- PersistentCollectionNode persistentCollectionNodeParent = (PersistentCollectionNode)baseNodeParent;
- enName = persistentCollectionNodeParent.getType().getName();
- }
- else {
- enName = baseNodeParent.getName();
- }
- enName = enName.substring(enName.lastIndexOf('.') + 1);
- propCriteria = NLS.bind(alias, prName, prName.charAt(0));
- }
- }
+ return ((BaseNode)node).getCriteria();
}
if ("".equals(enName)) { //$NON-NLS-1$
return ""; //$NON-NLS-1$
13 years, 1 month
JBoss Tools SVN: r36246 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-11-09 06:42:53 -0500 (Wed, 09 Nov 2011)
New Revision: 36246
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9975 - Accompany escaped symbols with "\"
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-11-09 11:08:14 UTC (rev 36245)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-11-09 11:42:53 UTC (rev 36246)
@@ -78,6 +78,8 @@
public static String FILE_PROTOCOL = "file:"; //$NON-NLS-1$
public static String HTTP_PROTOCOL = "http:"; //$NON-NLS-1$
public static String SLASH = "/"; //$NON-NLS-1$
+ public static final String[] REPLACED_CHARACTERS_REGEXP =
+ new String[] {"\\(", "\\)", "'", "\"", Constants.WHITE_SPACE}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
/**
* Returns CSS style declaration corresponding to the given {@code element}.
@@ -424,12 +426,10 @@
* @return format style string
*/
public static String addFullPathIntoURLValue(String value, VpePageContext pageContext) {
-
String urls[] = value.split(ATTR_URL);
if (urls.length == 1) {
return value;
}
-
IFile file = null;
final VpeIncludeInfo vii = pageContext.getVisualBuilder().getCurrentIncludeInfo();
if (vii != null && (vii.getStorage() instanceof IFile)) {
@@ -458,12 +458,10 @@
* @return Format style string
*/
public static String addFullPathIntoURLValue(String value, String href_val) {
-
String urls[] = value.split(ATTR_URL);
if (urls.length == 1) {
return value;
}
-
for (int i = 1; i < urls.length; i++) {
urls[i] = updateURLItem(urls[i]);
String[] urlParts = splitURL(urls[i]);
@@ -493,7 +491,8 @@
private static String[] splitURL(String url) {
int startAttr = url.indexOf(ATTR_URL);
int startPathIndex = url.indexOf(OPEN_BRACKET, startAttr);
- int endPathIndex = url.indexOf(CLOSE_BRACKET, startPathIndex + 1);
+// int endPathIndex = url.lastIndexOf(CLOSE_BRACKET, startPathIndex + 1);
+ int endPathIndex = url.lastIndexOf(CLOSE_BRACKET, url.length());
if (startPathIndex < 0 || endPathIndex < 0) {
return null;
}
@@ -692,46 +691,36 @@
* @return
*/
public static void refreshStyleElement(VpeVisualDomBuilder visualDomBuilder, VpeElementMapping elementMapping) {
-
nsIDOMNode value = null;
-
/*
- * data property( of "style's" elementMapping ) contains Map<Object,nsIDOMNode>. There is only one "style"
- * visual element in this map. So we get this element from map
- *
- * there is potential danger in this manner of keeping "style" element ( use property "data" of Object type )
+ * data property( of "style's" elementMapping ) contains Map<Object,nsIDOMNode>.
+ * There is only one "style" visual element in this map. So we get this element from map.
+ * There is potential danger in this manner of keeping "style" element ( use property "data" of Object type )
*/
-
Map<Object, nsIDOMNode> map = (Map<Object, nsIDOMNode>) elementMapping.getData();
-
// get "style" element
if (map != null) {
-
if (map.size() > 0) {
value = map.values().iterator().next();
}
}
-
- if (value == null)
+ if (value == null) {
return;
-
+ }
// get new value of style element
Node textNode = elementMapping.getSourceNode().getFirstChild();
String text = null;
-
if (textNode != null) {
text = textNode.getNodeValue();
}
-
nsIDOMNodeList list = value.getChildNodes();
-
// remove all children of style element
- for (int i = 0; i < list.getLength(); i++)
+ for (int i = 0; i < list.getLength(); i++) {
value.removeChild(list.item(i));
-
+ }
// add new value of style element
- value.appendChild(visualDomBuilder.getXulRunnerEditor().getDOMDocument().createTextNode(text));
-
+ value.appendChild(visualDomBuilder.getXulRunnerEditor()
+ .getDOMDocument().createTextNode(text));
}
public static String getAbsoluteResourcePath(String resourcePathInPlugin) {
@@ -773,12 +762,9 @@
}
public static String processUrl(String url, IFile baseFile) {
-
String resolvedUrl = url.replaceFirst(
"^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}", Constants.EMPTY); //$NON-NLS-1$
-
resolvedUrl = ElServiceUtil.replaceEl(baseFile, resolvedUrl);
-
URI uri = null;
try {
uri = new URI(resolvedUrl);
@@ -787,24 +773,29 @@
// so we just ignore this.
// VpePlugin.getDefault().logWarning("Error in parsiong URI string", e); //$NON-NLS-1$
}
-
- if (uri != null && uri.isAbsolute()) {
- return resolvedUrl;
+ if (uri == null || !uri.isAbsolute()) {
+ String decodedUrl = decodeUrl(resolvedUrl);
+ Path path = new Path(decodedUrl);
+ if (decodedUrl.startsWith("/") //$NON-NLS-1$
+ && path.segment(0).equals(baseFile.getProject().getName())) {
+ decodedUrl = "/" //$NON-NLS-1$
+ + path.removeFirstSegments(1).toPortableString();
+ }
+ IFile file = FileUtil.getFile(decodedUrl, baseFile);
+ if (file != null && file.getLocation() != null) {
+ resolvedUrl = pathToUrl(file.getLocation());
+ }
}
-
- String decodedUrl = decodeUrl(resolvedUrl);
-
- Path path = new Path(decodedUrl);
- if (decodedUrl.startsWith("/") //$NON-NLS-1$
- && path.segment(0).equals(baseFile.getProject().getName())) {
- decodedUrl = "/" //$NON-NLS-1$
- + path.removeFirstSegments(1).toPortableString();
+ /*
+ * https://issues.jboss.org/browse/JBIDE-9975
+ * Accompany escaped symbols with "\"
+ * Now all the URL string will be updated.
+ */
+ String n = null;
+ for (String str : REPLACED_CHARACTERS_REGEXP) {
+ n = "\\\\"+str.replaceAll("\\\\", Constants.EMPTY); //$NON-NLS-1$ //$NON-NLS-2$
+ resolvedUrl = resolvedUrl.replaceAll(str, n);
}
-
- IFile file = FileUtil.getFile(decodedUrl, baseFile);
- if (file != null && file.getLocation() != null) {
- return pathToUrl(file.getLocation());
- }
return resolvedUrl;
}
13 years, 1 month
JBoss Tools SVN: r36245 - trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2011-11-09 06:08:14 -0500 (Wed, 09 Nov 2011)
New Revision: 36245
Modified:
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java
Log:
JBIDE-9862 : fix Maven project selection from the Package Explorer. Selected Projects are IJavaProject instance, not IResource, so we need to use the IAdaptable plumbing
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java 2011-11-09 10:47:47 UTC (rev 36244)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/profiles/ProfileSelectionHandler.java 2011-11-09 11:08:14 UTC (rev 36245)
@@ -170,6 +170,11 @@
}
}
}
+ } else if (o instanceof IAdaptable) {
+ IProject p = (IProject)((IAdaptable) o).getAdapter(IProject.class);
+ if (p != null) {
+ projects.add(p);
+ }
}
}
}
13 years, 1 month
JBoss Tools SVN: r36244 - in trunk/maven: plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2011-11-09 05:47:47 -0500 (Wed, 09 Nov 2011)
New Revision: 36244
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/ProjectUtilTest.java
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
Log:
FIXED - issue JBIDE-10037: EE6 EAR Archetype fails to close after completion
https://issues.jboss.org/browse/JBIDE-10037
Rework after fbricon's code review
Added: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java 2011-11-09 10:47:47 UTC (rev 36244)
@@ -0,0 +1,63 @@
+package org.jboss.tools.maven.core;
+
+import java.io.File;
+import java.net.URI;
+
+import org.apache.maven.project.MavenProject;
+import org.eclipse.core.internal.resources.Project;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+
+/**
+ * A utility class for Eclipse Projects.
+ * @author Xavier Coulon
+ *
+ */
+public class ProjectUtil {
+
+ /**
+ * Refreshes the projects hierarchy. For example, if the project on
+ * which a facet should be installed is 'Parent1/Parent2/Child',
+ * then both Parent1, Parent2 and Child are refreshed.
+ *
+ * @param basedir : the base directory (absolute file system path) of the (child) project to refresh.
+ * @param refreshDepth: the refresh depth
+ * @param monitor : the progress monitor
+ * @return the number of projects that were refreshed
+ * @throws CoreException
+ * in case of problem during refresh
+ * @see IResource for depth values.
+ */
+ public static int refreshHierarchy(File basedir, int refreshDepth, IProgressMonitor monitor) throws CoreException {
+ try {
+ int count = 0;
+ final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ final IProject[] projects = root.getProjects();
+ final IPath rootLocation = root.getLocation();
+ IPath basedirPath = new Path(basedir.getAbsolutePath());
+ while(basedirPath.matchingFirstSegments(rootLocation) > 0) {
+ for(IProject project : projects) {
+ final IPath projectLocation = project.getLocation();
+ if(projectLocation.equals(basedirPath) && project.isOpen()) {
+ project.refreshLocal(refreshDepth, monitor);
+ count++;
+ break;
+ }
+ }
+ basedirPath = basedirPath.removeLastSegments(1);
+ }
+ return count;
+ } finally {
+ monitor.done();
+ }
+ }
+
+}
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/ProjectUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-09 10:14:43 UTC (rev 36243)
+++ trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2011-11-09 10:47:47 UTC (rev 36244)
@@ -16,10 +16,12 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
@@ -44,6 +46,7 @@
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.util.EclipseJavaUtil;
import org.jboss.tools.maven.core.IJBossMavenConstants;
+import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
import org.jboss.tools.maven.ui.Activator;
import org.maven.ide.eclipse.wtp.WarPluginConfiguration;
@@ -78,49 +81,11 @@
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
MavenProject mavenProject = request.getMavenProject();
- refreshHierarchy(mavenProject, new SubProgressMonitor(monitor, 1));
IProject project = request.getProject();
configureInternal(mavenProject, project, monitor);
}
- /**
- * Refreshes the Maven projects hierarchy. For example, if the project on
- * which the JAX-RS facet should be installed is 'Parent1/Parent2/Child',
- * then both Parent1, Parent2 and Child are refreshed.
- *
- * @param mavenProject
- * @throws CoreException
- * in case of problem during refresh
- */
- private void refreshHierarchy(MavenProject mavenProject, IProgressMonitor monitor) throws CoreException {
- try {
- File basedir = mavenProject.getBasedir();
- IProject project = getProjectAt(basedir);
- while (project != null) {
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- basedir = basedir.getParentFile();
- project = getProjectAt(basedir);
- }
- } finally {
- monitor.done();
- }
- }
- /**
- * Returns the project given its absolute location on the filesystem
- * @param basedir
- * @return the project or null if no project exists at the given location
- */
- private IProject getProjectAt(File basedir) {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
- .getProjects();
- for (IProject project : projects) {
- if (project.getLocation().toFile().equals(basedir)) {
- return project;
- }
- }
- return null;
- }
private void configureInternal(MavenProject mavenProject,IProject project,
@@ -169,6 +134,9 @@
if (facetVersion != null) {
IStatus status = facetVersion.getConstraint().check(fproj.getProjectFacets());
if (status.isOK()) {
+ // refreshing the project hierarchy to make sure that Eclipse "sees" the .settings folder and file, to be able to add the JAX-RS Facet
+ // see https://issues.jboss.org/browse/JBIDE-10037
+ ProjectUtil.refreshHierarchy(mavenProject.getBasedir(), IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
IDataModel model = createJaxRsDataModel(fproj,facetVersion);
WarPluginConfiguration config = new WarPluginConfiguration(mavenProject, fproj.getProject());
String warSourceDirectory = config.getWarSourceDirectory();
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml 2011-11-09 10:47:47 UTC (rev 36244)
@@ -0,0 +1,18 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>jaxrs-3layers-middle</artifactId>
+ <groupId>foo.bar</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>jaxrs-3layers-child</artifactId>
+ <packaging>war</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ws.rs</groupId>
+ <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ <version>1.0.0.Final</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Property changes on: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml 2011-11-09 10:47:47 UTC (rev 36244)
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>jaxrs-3layers-root</artifactId>
+ <groupId>foo.bar</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>jaxrs-3layers-middle</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>jaxrs-3layers-child</module>
+ </modules>
+</project>
\ No newline at end of file
Property changes on: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/pom.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/pom.xml 2011-11-09 10:47:47 UTC (rev 36244)
@@ -0,0 +1,10 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>foo.bar</groupId>
+ <artifactId>jaxrs-3layers-root</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>jaxrs-3layers-middle</module>
+ </modules>
+</project>
\ No newline at end of file
Property changes on: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jaxrs/jaxrs-3layers-root/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/ProjectUtilTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/ProjectUtilTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/ProjectUtilTest.java 2011-11-09 10:47:47 UTC (rev 36244)
@@ -0,0 +1,28 @@
+package org.jboss.tools.maven.core;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.m2e.core.project.ResolverConfiguration;
+import org.jboss.tools.maven.configurators.tests.AbstractMavenConfiguratorTest;
+import org.junit.Test;
+
+@SuppressWarnings("restriction")
+public class ProjectUtilTest extends AbstractMavenConfiguratorTest {
+
+ @Test
+ public void testShouldRefreshProjectHierarchy() throws IOException, CoreException, InterruptedException {
+ //String projectLocation = "projects/jaxrs/jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child";
+ IProject[] jaxrsProject = importProjects("projects/jaxrs/",
+ new String[]{"jaxrs-3layers-root/pom.xml",
+ "jaxrs-3layers-root/jaxrs-3layers-middle/pom.xml",
+ "jaxrs-3layers-root/jaxrs-3layers-middle/jaxrs-3layers-child/pom.xml"}, new ResolverConfiguration());
+ waitForJobsToComplete(new NullProgressMonitor());
+ File basedir = jaxrsProject[2].getLocation().toFile();
+ assertEquals(3, ProjectUtil.refreshHierarchy(basedir, IResource.DEPTH_INFINITE, new NullProgressMonitor()));
+ }
+}
Property changes on: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/core/ProjectUtilTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 1 month