JBoss Tools SVN: r38074 - in trunk: as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-24 04:34:20 -0500 (Tue, 24 Jan 2012)
New Revision: 38074
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
Log:
JBIDE-10490 and JBIDE-10700 to trunk for beta1
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2012-01-24 09:34:20 UTC (rev 38074)
@@ -28,6 +28,7 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerAttributes;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
@@ -178,7 +179,7 @@
/**
* @since 2.3
*/
- public static String getFromSecureStorage(IServer server, String key) {
+ public static String getFromSecureStorage(IServerAttributes server, String key) {
try {
ISecurePreferences node = getNode(server);
String val = node.get(key, null);
@@ -210,7 +211,7 @@
}
}
- private static ISecurePreferences getNode(IServer server) throws UnsupportedEncodingException {
+ private static ISecurePreferences getNode(IServerAttributes server) throws UnsupportedEncodingException {
String secureKey = new StringBuilder(PREFERNCES_BASEKEY)
.append(server.getName())
.append(Path.SEPARATOR).toString();
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2012-01-24 09:34:20 UTC (rev 38074)
@@ -122,6 +122,7 @@
public SetPassCommand(IServerWorkingCopy server) {
super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(),
IJBossToolingConstants.SERVER_PASSWORD, passModifyListener);
+ oldVal = passText.getText();
}
public void execute() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerWorkingCopyPropertyCommand.java 2012-01-24 09:34:20 UTC (rev 38074)
@@ -24,7 +24,8 @@
this.key = attributeKey;
this.newVal = newVal;
this.listener = listener;
- this.oldVal = wc.getAttribute(attributeKey, ""); //$NON-NLS-1$
+ if( key != null )
+ this.oldVal = wc.getAttribute(attributeKey, ""); //$NON-NLS-1$
}
public void execute() {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/META-INF/MANIFEST.MF 2012-01-24 09:34:20 UTC (rev 38074)
@@ -36,7 +36,8 @@
org.eclipse.ui.console;bundle-version="3.5.100",
org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.wst.common.modulecore;bundle-version="1.2.101",
- org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0"
+ org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0",
+ org.eclipse.ui.forms;bundle-version="3.5.101"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.jboss.tools.common.databinding,
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-01-24 09:34:20 UTC (rev 38074)
@@ -238,5 +238,15 @@
</build>
</profile></pattern>
</template>
+ </extension>
+ <extension
+ point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ class="org.jboss.tools.openshift.express.internal.ui.behaviour.ExpressDetailsSection"
+ id="org.jboss.tools.openshift.express.ui.behaviour.details.section"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ order="10"
+ typeIds="org.jboss.tools.openshift.express.openshift.server.type">
+ </section>
</extension>
</plugin>
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-01-24 09:02:49 UTC (rev 38073)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-01-24 09:34:20 UTC (rev 38074)
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.behaviour;
+import static org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants.SERVER_PASSWORD;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.server.core.IRuntime;
@@ -23,6 +25,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerCreationUtils;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
/**
* This class holds the attribute names whose values will be
@@ -39,6 +42,7 @@
public static final String ATTRIBUTE_APPLICATION_ID = "org.jboss.tools.openshift.express.internal.core.behaviour.ApplicationId";
public static final String ATTRIBUTE_DOMAIN = "org.jboss.tools.openshift.express.internal.core.behaviour.Domain";
public static final String ATTRIBUTE_USERNAME = "org.jboss.tools.openshift.express.internal.core.behaviour.Username";
+ // Legacy, not to be used
public static final String ATTRIBUTE_PASSWORD = "org.jboss.tools.openshift.express.internal.core.behaviour.Password";
public static final String ATTRIBUTE_REMOTE_NAME = "org.jboss.tools.openshift.express.internal.core.behaviour.RemoteName";
public static final String ATTRIBUTE_REMOTE_NAME_DEFAULT = "origin";
@@ -88,6 +92,16 @@
return wc.save(false, new NullProgressMonitor());
}
+ public static String getExpressRemoteName(IServerAttributes attributes ) {
+ return attributes.getAttribute(ATTRIBUTE_REMOTE_NAME, (String)null);
+ }
+
+ public static IServer setExpressRemoteName(IServer server, String val) throws CoreException {
+ IServerWorkingCopy wc = server.createWorkingCopy();
+ wc.setAttribute(ATTRIBUTE_REMOTE_NAME, val);
+ return wc.save(false, new NullProgressMonitor());
+ }
+
public static String getExpressUsername(IServerAttributes attributes ) {
return attributes.getAttribute(ATTRIBUTE_USERNAME, (String)null);
}
@@ -99,14 +113,20 @@
}
// TODO Must secure this!!!
- public static String getExpressPassword(IServerAttributes attributes ) {
- return attributes.getAttribute(ATTRIBUTE_PASSWORD, (String)null);
+ public static String getExpressPassword(IServerWorkingCopy server ) {
+ return getExpressApplicationId(server.getOriginal());
}
+ public static String getExpressPassword(IServer server ) {
+ String s = ServerUtil.getFromSecureStorage(server, ExpressServerUtils.ATTRIBUTE_PASSWORD);
+ if( s == null )
+ return server.getAttribute(ExpressServerUtils.ATTRIBUTE_PASSWORD, (String)null);
+ return s;
+ }
+
public static IServer setExpressPassword(IServer server, String val) throws CoreException {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.setAttribute(ATTRIBUTE_PASSWORD, val);
- return wc.save(false, new NullProgressMonitor());
+ ServerUtil.storeInSecureStorage(server, ExpressServerUtils.ATTRIBUTE_PASSWORD, val);
+ return server;
}
@@ -182,7 +202,6 @@
wc.setHost(host);
wc.setAttribute(IDeployableServer.SERVER_MODE, "openshift");
wc.setAttribute(ATTRIBUTE_USERNAME, username);
- wc.setAttribute(ATTRIBUTE_PASSWORD, password);
wc.setAttribute(ATTRIBUTE_DOMAIN, domain);
wc.setAttribute(ATTRIBUTE_APPLICATION_NAME, appName);
wc.setAttribute(ATTRIBUTE_APPLICATION_ID, appId);
@@ -192,7 +211,9 @@
wc.setAttribute(IJBossToolingConstants.IGNORE_LAUNCH_COMMANDS, "true");
wc.setAttribute(IJBossToolingConstants.WEB_PORT, 80);
wc.setAttribute(IJBossToolingConstants.WEB_PORT_DETECT, "false");
- return wc.save(true, new NullProgressMonitor());
+ IServer saved = wc.save(true, new NullProgressMonitor());
+ ExpressServerUtils.setExpressPassword(wc, password);
+ return saved;
}
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-01-24 09:34:20 UTC (rev 38074)
@@ -0,0 +1,148 @@
+package org.jboss.tools.openshift.express.internal.ui.behaviour;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+
+public class ExpressDetailsSection extends ServerEditorSection {
+ private ModifyListener nameModifyListener, remoteModifyListener, passModifyListener;
+ private Text nameText, passText, remoteText;
+ private ServerAttributeHelper helper;
+
+ private String passwordString;
+
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
+ section.setText("Express Server in Source Mode (Details)");
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
+ Composite composite = toolkit.createComposite(section);
+ composite.setLayout(new GridLayout(2, false));
+
+ fillSection(composite, toolkit);
+ addListeners();
+
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ }
+
+ private void fillSection(Composite composite, FormToolkit toolkit) {
+
+ GridData d = new GridData(); d.horizontalSpan = 2;
+
+ Label appName = toolkit.createLabel(composite, "Application Name");
+ Label appNameVal = toolkit.createLabel(composite, ExpressServerUtils.getExpressApplicationName(server));
+ Label appId = toolkit.createLabel(composite, "Application Id");
+ Label appIdVal = toolkit.createLabel(composite, ExpressServerUtils.getExpressApplicationId(server));
+
+ Label username = toolkit.createLabel(composite, Messages.swf_Username);
+ username.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ String n = ExpressServerUtils.getExpressUsername(server);
+ nameText = toolkit.createText(composite, n);
+ String p = ExpressServerUtils.getExpressPassword(server.getOriginal());
+ Label password = toolkit.createLabel(composite, Messages.swf_Password);
+ password.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passText = toolkit.createText(composite, p);
+ passwordString = p;
+ String remote = ExpressServerUtils.getExpressRemoteName(server);
+ Label remoteName = toolkit.createLabel(composite, "Remote Name");
+ remoteName.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ remoteText = toolkit.createText(composite, remote);
+
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ nameText.setLayoutData(d);
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ passText.setLayoutData(d);
+
+ }
+
+ private void addListeners() {
+ nameModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetUserCommand(server));
+ }
+ };
+ remoteModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetRemoteCommand(server));
+ }
+ };
+
+ passModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetPassCommand(server));
+ }
+ };
+
+ nameText.addModifyListener(nameModifyListener);
+ remoteText.addModifyListener(remoteModifyListener);
+ passText.addModifyListener(passModifyListener);
+ }
+
+ public class SetUserCommand extends ServerWorkingCopyPropertyCommand {
+ public SetUserCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangeUsernameCommandName, nameText, nameText.getText(),
+ ExpressServerUtils.ATTRIBUTE_USERNAME, nameModifyListener);
+ }
+ }
+
+ public class SetRemoteCommand extends ServerWorkingCopyPropertyCommand {
+ public SetRemoteCommand(IServerWorkingCopy server) {
+ super(server, "Change Remote Name", remoteText, remoteText.getText(),
+ ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, remoteModifyListener);
+ }
+ }
+
+ public class SetPassCommand extends ServerWorkingCopyPropertyCommand {
+ public SetPassCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(),
+ null, passModifyListener);
+ oldVal = passText.getText();
+ }
+
+ public void execute() {
+ passwordString = newVal;
+ }
+
+ public void undo() {
+ passwordString = oldVal;
+ text.removeModifyListener(listener);
+ text.setText(oldVal);
+ text.addModifyListener(listener);
+ }
+ }
+
+ /**
+ * Allow a section an opportunity to respond to a doSave request on the editor.
+ * @param monitor the progress monitor for the save operation.
+ */
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ ExpressServerUtils.setExpressPassword(server.getOriginal(), passwordString);
+ monitor.worked(100);
+ } catch( CoreException ce ) {
+ // TODO
+ }
+ }
+
+}
13 years
JBoss Tools SVN: r38073 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-24 04:02:49 -0500 (Tue, 24 Jan 2012)
New Revision: 38073
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
Log:
[JBIDE-10653] moved url building to GoogleAnalyticsUrlStrategy, keeping AbstractGooleAnalyticsParameter a simple value holder
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java 2012-01-24 08:50:26 UTC (rev 38072)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java 2012-01-24 09:02:49 UTC (rev 38073)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.usage.googleanalytics;
-import java.text.MessageFormat;
/**
@@ -73,9 +72,5 @@
public String getValue() {
return value;
}
-
- public String toString() {
- return MessageFormat.format("5({0}*{1}*{2})", name, label, value);
- }
}
}
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2012-01-24 08:50:26 UTC (rev 38072)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2012-01-24 09:02:49 UTC (rev 38073)
@@ -18,7 +18,9 @@
package org.jboss.tools.usage.googleanalytics;
import java.io.UnsupportedEncodingException;
+import java.text.MessageFormat;
+import org.jboss.tools.usage.googleanalytics.AbstractGoogleAnalyticsParameters.GoogleAnalyticsEvent;
import org.jboss.tools.usage.tracker.IFocusPoint;
import org.jboss.tools.usage.tracker.IURLBuildingStrategy;
import org.jboss.tools.usage.util.HttpEncodingUtils;
@@ -73,7 +75,7 @@
/**
* TODO: support multiple events. Obviously these would just get appended to the very same string
*/
- appendParameter(IGoogleAnalyticsParameters.PARAM_EVENT_TRACKING, googleParameters.getEvent().toString(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_EVENT_TRACKING, googleParameters.getEvent(), builder);
appendParameter(IGoogleAnalyticsParameters.PARAM_REFERRAL, googleParameters.getReferral(), builder);
appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_REQUEST, focusPoint.getURI(), builder);
@@ -186,6 +188,13 @@
return Integer.toString((int) (Math.random() * 0x7fffffff));
}
+ private void appendParameter(String name, GoogleAnalyticsEvent event, StringBuilder builder) {
+ appendParameter(name,
+ MessageFormat.format("5({0}*{1}*{2})", event.getName(), event.getLabel(), event.getValue()),
+ true,
+ builder);
+ }
+
private void appendParameter(String name, String value, StringBuilder builder) {
appendParameter(name, value, true, builder);
}
13 years
JBoss Tools SVN: r38072 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-01-24 03:50:26 -0500 (Tue, 24 Jan 2012)
New Revision: 38072
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
Log:
https://issues.jboss.org/browse/JBIDE-10571
Run code formatting on the generated java files
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2012-01-24 07:21:01 UTC (rev 38071)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ext/ConsoleExtension.java 2012-01-24 08:50:26 UTC (rev 38072)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.hibernate.eclipse.console.ext;
+import java.io.File;
+import java.util.Map;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
@@ -26,7 +29,16 @@
public void setHibernateException(HibernateExtension hibernateExtension);
- public void launchExporters(ILaunchConfiguration configuration, String mode,
+ /**
+ *
+ * @param configuration
+ * @param mode
+ * @param launch
+ * @param monitor
+ * @return the generated files separated by the contents
+ * @throws CoreException
+ */
+ public Map<String, File[]> launchExporters(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException;
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-01-24 07:21:01 UTC (rev 38071)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-01-24 08:50:26 UTC (rev 38072)
@@ -265,8 +265,12 @@
ExporterAttributes attributes = new ExporterAttributes(configuration);
ConsoleConfiguration cc = KnownConfigurations.getInstance().find(attributes.getConsoleConfigurationName());
ConsoleExtension consoleExtension = ConsoleExtensionManager.getConsoleExtension(cc.getHibernateExtension());
- consoleExtension.launchExporters(configuration, mode, launch, monitor);
-
+ Map<String, File[]> generatedFiles = consoleExtension.launchExporters(configuration, mode, launch, monitor);
+ // code formatting needs to happen *after* refresh to make sure eclipse will format the uptodate files!
+ if(generatedFiles!=null) {
+ formatGeneratedCode( monitor, generatedFiles );
+ }
+
/* The code is moved to consoleExtension and delegated method is called instead.
List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
@@ -334,10 +338,10 @@
}
- private void formatGeneratedCode(IProgressMonitor monitor, ArtifactCollector collector) {
+ private void formatGeneratedCode(IProgressMonitor monitor, Map<String, File[]> generatedFiles) {
final TextFileBufferOperation operation = new FormatGeneratedCode( HibernateConsoleMessages.CodeGenerationLaunchDelegate_formate_generated_code );
- File[] javaFiles = collector.getFiles("java"); //$NON-NLS-1$
+ File[] javaFiles = generatedFiles.get("java"); //$NON-NLS-1$
if(javaFiles.length>0) {
IPath[] locations = new IPath[javaFiles.length];
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-01-24 07:21:01 UTC (rev 38071)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_5/src/org/jboss/tools/hibernate3_5/console/ConsoleExtension3_5.java 2012-01-24 08:50:26 UTC (rev 38072)
@@ -12,9 +12,11 @@
import java.io.File;
import java.lang.reflect.Constructor;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -98,8 +100,9 @@
/* (non-Javadoc)
* @see org.hibernate.eclipse.console.ext.ConsoleExtension#launchExporters(org.hibernate.eclipse.console.ext.ILaunchConfiguration, java.lang.String, org.hibernate.eclipse.console.ext.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @SuppressWarnings("unchecked")
@Override
- public void launchExporters(ILaunchConfiguration configuration,
+ public Map<String, File[]> launchExporters(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
Assert.isNotNull(configuration);
@@ -126,10 +129,14 @@
// code formatting needs to happen *after* refresh to make sure eclipse will format the uptodate files!
if(collector!=null) {
- //formatGeneratedCode( monitor, collector );
+ Map<String, File[]> map = new HashMap<String, File[]>();
+ Set<String> types = collector.getFileTypes();
+ for (String type : types) {
+ File[] files = collector.getFiles(type.toString());
+ map.put(type, files);
+ }
+ return map;
}
-
-
} catch(Exception e) {
throw new CoreException(HibernateConsolePlugin.throwableToStatus(e, 666));
} catch(NoClassDefFoundError e) {
@@ -137,6 +144,7 @@
} finally {
monitor.done();
}
+ return null;
}
private ArtifactCollector runExporters (final ExporterAttributes attributes, final ExporterFactory[] exporterFactories, final Set<String> outputDirectories, final IProgressMonitor monitor)
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-01-24 07:21:01 UTC (rev 38071)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/console/ConsoleExtension3_6.java 2012-01-24 08:50:26 UTC (rev 38072)
@@ -12,9 +12,11 @@
import java.io.File;
import java.lang.reflect.Constructor;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -97,8 +99,9 @@
/* (non-Javadoc)
* @see org.hibernate.eclipse.console.ext.ConsoleExtension#launchExporters(org.hibernate.eclipse.console.ext.ILaunchConfiguration, java.lang.String, org.hibernate.eclipse.console.ext.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @SuppressWarnings("unchecked")
@Override
- public void launchExporters(ILaunchConfiguration configuration,
+ public Map<String, File[]> launchExporters(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
Assert.isNotNull(configuration);
@@ -125,7 +128,13 @@
// code formatting needs to happen *after* refresh to make sure eclipse will format the uptodate files!
if(collector!=null) {
- //formatGeneratedCode( monitor, collector );
+ Map<String, File[]> map = new HashMap<String, File[]>();
+ Set<String> types = collector.getFileTypes();
+ for (String type : types) {
+ File[] files = collector.getFiles(type.toString());
+ map.put(type, files);
+ }
+ return map;
}
@@ -136,6 +145,7 @@
} finally {
monitor.done();
}
+ return null;
}
private ArtifactCollector runExporters (final ExporterAttributes attributes, final ExporterFactory[] exporterFactories, final Set<String> outputDirectories, final IProgressMonitor monitor)
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-01-24 07:21:01 UTC (rev 38071)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/console/ConsoleExtension4_0.java 2012-01-24 08:50:26 UTC (rev 38072)
@@ -12,9 +12,11 @@
import java.io.File;
import java.lang.reflect.Constructor;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -97,8 +99,9 @@
/* (non-Javadoc)
* @see org.hibernate.eclipse.console.ext.ConsoleExtension#launchExporters(org.hibernate.eclipse.console.ext.ILaunchConfiguration, java.lang.String, org.hibernate.eclipse.console.ext.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
*/
+ @SuppressWarnings("unchecked")
@Override
- public void launchExporters(ILaunchConfiguration configuration,
+ public Map<String, File[]> launchExporters(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor)
throws CoreException {
Assert.isNotNull(configuration);
@@ -125,10 +128,14 @@
// code formatting needs to happen *after* refresh to make sure eclipse will format the uptodate files!
if(collector!=null) {
- //formatGeneratedCode( monitor, collector );
+ Map<String, File[]> map = new HashMap<String, File[]>();
+ Set<String> types = collector.getFileTypes();
+ for (String type : types) {
+ File[] files = collector.getFiles(type.toString());
+ map.put(type, files);
+ }
+ return map;
}
-
-
} catch(Exception e) {
throw new CoreException(HibernateConsolePlugin.throwableToStatus(e, 666));
} catch(NoClassDefFoundError e) {
@@ -136,6 +143,7 @@
} finally {
monitor.done();
}
+ return null;
}
private ArtifactCollector runExporters (final ExporterAttributes attributes, final ExporterFactory[] exporterFactories, final Set<String> outputDirectories, final IProgressMonitor monitor)
13 years
JBoss Tools SVN: r38071 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-24 02:21:01 -0500 (Tue, 24 Jan 2012)
New Revision: 38071
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-10490 - secure passwords for app servers (NOT openshift) - fix to use the default storage location
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2012-01-24 06:44:13 UTC (rev 38070)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2012-01-24 07:21:01 UTC (rev 38071)
@@ -11,10 +11,8 @@
package org.jboss.ide.eclipse.as.core.util;
import java.io.File;
-import java.io.IOError;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.net.URL;
import java.net.URLEncoder;
import org.eclipse.core.runtime.CoreException;
@@ -177,7 +175,6 @@
}
- private static final String SECURE = "secure"; //$NON-NLS-1$
/**
* @since 2.3
*/
@@ -196,6 +193,8 @@
}
}
+ private static final String PREFERNCES_BASEKEY = JBossServerCorePlugin.PLUGIN_ID.replace('.', Path.SEPARATOR);
+
/**
* @since 2.3
*/
@@ -212,17 +211,13 @@
}
private static ISecurePreferences getNode(IServer server) throws UnsupportedEncodingException {
- try {
- IPath p = JBossServerCorePlugin.getServerStateLocation(server).append(SECURE);
- if( !p.toFile().exists())
- p.toFile().mkdirs();
-
- URL url = p.toFile().toURI().toURL();
- ISecurePreferences root = SecurePreferencesFactory.open(url, null);
- return root;
- } catch(IOException ioe ) {
- return null;
- }
+ String secureKey = new StringBuilder(PREFERNCES_BASEKEY)
+ .append(server.getName())
+ .append(Path.SEPARATOR).toString();
+
+ ISecurePreferences root = SecurePreferencesFactory.getDefault();
+ String encoded = URLEncoder.encode(secureKey, "UTF-8"); //$NON-NLS-1$
+ return root.node(encoded);
}
}
13 years
JBoss Tools SVN: r38070 - in trunk/as: plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-01-24 01:44:13 -0500 (Tue, 24 Jan 2012)
New Revision: 38070
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/.api_filters
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ZippedFilterTest.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ASArchivesIntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/MockPublishMethod.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/PublishingFilterTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/IOUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-10642 - more test cases
Added: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/.api_filters
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/.api_filters (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/.settings/.api_filters 2012-01-24 06:44:13 UTC (rev 38070)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.jboss.ide.eclipse.archives.webtools" version="2">
+ <resource path="src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java" type="org.jboss.ide.eclipse.archives.webtools.modules.LocalZippedPublisherUtil">
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.jboss.ide.eclipse.archives.webtools.modules.LocalZippedPublisherUtil"/>
+ <message_argument value="publishChanges(IServer, IModuleResourceDelta[], File)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/LocalZippedPublisherUtil.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -38,6 +38,7 @@
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.publishers.patterns.IModulePathFilter;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
@@ -248,7 +249,10 @@
TrueZipUtil.createArchive(path);
de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
IModuleResource[] resources = getResources(module);
- IStatus[] copyResults = copy(root, resources);
+ DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
+ IModulePathFilter filter = beh.getPathFilter(module);
+ IModuleResource[] resources2 = filter == null ? resources : filter.getFilteredMembers();
+ IStatus[] copyResults = copy(root, resources2);
results.addAll(Arrays.asList(copyResults));
IModule[] children = server.getChildModules(module, new NullProgressMonitor());
@@ -277,10 +281,17 @@
IPath path = getOutputFilePath(module);
de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
- return publishChanges(server, deltas, root);
+ DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
+ IModulePathFilter filter = beh.getPathFilter(module);
+
+ return publishChanges(server, deltas, root, filter);
}
- protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas, de.schlichtherle.io.File root) {
+ /**
+ * @since 2.3
+ */
+ protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas,
+ de.schlichtherle.io.File root, IModulePathFilter filter) {
ArrayList<IStatus> results = new ArrayList<IStatus>();
if( deltas == null || deltas.length == 0 )
return new IStatus[]{};
@@ -290,11 +301,15 @@
dKind = deltas[i].getKind();
resource = deltas[i].getModuleResource();
if( dKind == IModuleResourceDelta.ADDED ) {
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ if( filter != null && filter.shouldInclude(resource)) {
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ }
} else if( dKind == IModuleResourceDelta.CHANGED ) {
- if( resource instanceof IModuleFile )
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
+ if( filter != null && filter.shouldInclude(resource)) {
+ if( resource instanceof IModuleFile )
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root, filter)));
+ }
} else if( dKind == IModuleResourceDelta.REMOVED) {
de.schlichtherle.io.File f = getFileInArchive(root,
resource.getModuleRelativePath().append(
@@ -304,7 +319,7 @@
results.add(generateDeleteFailedStatus(f));
hasBeenChanged = true;
} else if( dKind == IModuleResourceDelta.NO_CHANGE ) {
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root)));
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(), root, filter)));
}
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/META-INF/MANIFEST.MF 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/META-INF/MANIFEST.MF 2012-01-24 06:44:13 UTC (rev 38070)
@@ -24,6 +24,7 @@
org.jboss.ide.eclipse.as.test;bundle-version="2.2.0",
org.eclipse.wst.common.frameworks;bundle-version="1.2.100",
org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
- org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200"
+ org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
+ org.eclipse.wst.common.modulecore;bundle-version="1.2.103"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.ide.eclipse.as.archives.integration.test
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ASArchivesIntegrationTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ASArchivesIntegrationTestSuite.java 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ASArchivesIntegrationTestSuite.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -31,6 +31,7 @@
suite.addTestSuite(BuildDeployTest.class);
suite.addTestSuite(SingleFileZippedDeploymentIntegrationTest.class);
suite.addTestSuite(JSTEarWithNestedWebProjectIncrementalPublish.class);
+ suite.addTestSuite(ZippedFilterTest.class);
return suite;
}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ZippedFilterTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ZippedFilterTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.archives.integration.test/src/org/jboss/ide/eclipse/as/archives/integration/test/ZippedFilterTest.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -0,0 +1,129 @@
+package org.jboss.ide.eclipse.as.archives.integration.test;
+
+import java.io.File;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.internal.ServerPreferences;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.jboss.ide.eclipse.as.core.publishers.patterns.IModulePathFilter;
+import org.jboss.ide.eclipse.as.core.publishers.patterns.PublishFilterDirectoryScanner;
+import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.test.ASTest;
+import org.jboss.ide.eclipse.as.test.publishing.v2.Mock2BehaviourDelegate;
+import org.jboss.ide.eclipse.as.test.publishing.v2.MockPublishMethod;
+import org.jboss.ide.eclipse.as.test.publishing.v2.PublishFilterDirectoryScannerTest;
+import org.jboss.ide.eclipse.as.test.util.IOUtil;
+import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
+import org.jboss.ide.eclipse.as.test.util.wtp.JavaEEFacetConstants;
+import org.jboss.ide.eclipse.as.test.util.wtp.OperationTestCase;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectCreationUtil;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectUtility;
+
+public class ZippedFilterTest extends TestCase {
+ public void tearDown() throws Exception {
+ ServerRuntimeUtils.deleteAllServers();
+ ServerRuntimeUtils.deleteAllRuntimes();
+ ProjectUtility.deleteAllProjects();
+ ASTest.clearStateLocation();
+ }
+
+ private IProject createProject(String name) throws Exception {
+ IDataModel dm = ProjectCreationUtil.getWebDataModel("module1", null, null,
+ "myContent", null, JavaEEFacetConstants.WEB_25, false);
+ OperationTestCase.runAndVerify(dm);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ IFile f = p.getFile(new Path("myContent/includeme.txt"));
+ IOUtil.setContents(f, "includeMe");
+ IFile f2 = p.getFile(new Path("myContent/DONTincludeme.txt"));
+ IOUtil.setContents(f2, "leave me out");
+ return p;
+ }
+
+ public void testServerIntegration() throws CoreException, IOException, Exception {
+ IServer server = ServerRuntimeUtils.createMockServerWithRuntime(IJBossToolingConstants.SERVER_AS_60,
+ "name1", "default");
+ server = ServerRuntimeUtils.useMock2PublishMethod(server);
+ server = ServerRuntimeUtils.setZipped(server, true);
+ IProject project = createProject("module1");
+ MockPublishMethod.reset();
+
+ ServerPreferences.getInstance().setAutoPublishing(false);
+ IModule mod = ServerUtil.getModule(project);
+ server = ServerRuntimeUtils.addModule(server, mod);
+ ModuleDelegate md = (ModuleDelegate)mod.loadAdapter(ModuleDelegate.class, null);
+
+ DelegatingServerBehavior beh = (DelegatingServerBehavior)server.loadAdapter(DelegatingServerBehavior.class, null);
+ Mock2BehaviourDelegate del = (Mock2BehaviourDelegate)beh.getDelegate();
+ del.setUseSuperclassBehaviour(true);
+ IModulePathFilter filter = del.getPathFilter(new IModule[]{mod});
+ IModuleResource[] originalMembers = md.members();
+ IModuleResource[] filteredMembers = filter == null ? originalMembers : filter.getFilteredMembers();
+ int oCount = PublishFilterDirectoryScannerTest.countAllResources(originalMembers);
+ int fCount = PublishFilterDirectoryScannerTest.countAllResources(filteredMembers);
+ assertEquals(oCount, fCount);
+
+ IVirtualComponent vc = ComponentCore.createComponent(mod.getProject());
+
+ vc.setMetaProperty("component.inclusion.patterns", "**/*");
+ vc.setMetaProperty("component.exclusion.patterns", "**/*.txt");
+
+ filter = del.getPathFilter(new IModule[]{mod});
+ originalMembers = md.members();
+ filteredMembers = filter.getFilteredMembers();
+ oCount = PublishFilterDirectoryScannerTest.countAllResources(originalMembers);
+ fCount = PublishFilterDirectoryScannerTest.countAllResources(filteredMembers);
+ assertEquals(oCount, fCount+2);
+
+ vc.setMetaProperty("component.inclusion.patterns", "**/*");
+ vc.setMetaProperty("component.exclusion.patterns", "**/DON*");
+
+ filter = del.getPathFilter(new IModule[]{mod});
+ originalMembers = md.members();
+ filteredMembers = filter.getFilteredMembers();
+ oCount = PublishFilterDirectoryScannerTest.countAllResources(originalMembers);
+ fCount = PublishFilterDirectoryScannerTest.countAllResources(filteredMembers);
+ assertEquals(oCount, fCount+1);
+
+
+ IModuleResource r = PublishFilterDirectoryScanner.findResource(originalMembers, null,
+ new Path("DONTincludeme.txt"));
+ assertNotNull(r);
+ assertFalse(filter.shouldInclude(r));
+ r = PublishFilterDirectoryScanner.findResource(originalMembers, null,
+ new Path("includeme.txt"));
+ assertNotNull(r);
+ assertTrue(filter.shouldInclude(r));
+
+ MockPublishMethod.reset();
+ server.publish(IServer.PUBLISH_FULL, new NullProgressMonitor());
+
+ IModuleFile[] copied = MockPublishMethod.getChangedFiles();
+ assertTrue(copied.length == 1);
+ IModuleFile f1 = copied[0];
+ File f2 = (File)f1.getAdapter(File.class);
+
+ IPath unzip3 = ASTest.getDefault().getStateLocation().append("unzip3");
+ IOUtil.unzipFile(new Path(f2.getAbsolutePath()),unzip3);
+ assertEquals(IOUtil.countAllResources(unzip3.toFile()), fCount+1);
+
+ }
+
+}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/MockPublishMethod.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/MockPublishMethod.java 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/MockPublishMethod.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -30,7 +30,8 @@
public static final String MOCK_ROOT = "mockRoot";
public static ArrayList<IPath> changed = new ArrayList<IPath>();
public static ArrayList<IPath> removed = new ArrayList<IPath>();
-
+ public static ArrayList<IModuleFile> copiedFiles = new ArrayList<IModuleFile>();
+
public IPublishCopyCallbackHandler getCallbackHandler(IPath path,
IServer server) {
return new MockCopyCallbackHandler(path);
@@ -46,11 +47,15 @@
public static void reset() {
changed.clear();
removed.clear();
+ copiedFiles.clear();
}
public static IPath[] getRemoved() {
return (IPath[]) removed.toArray(new IPath[removed.size()]);
}
-
+ public static IModuleFile[] getChangedFiles() {
+ return copiedFiles.toArray(new IModuleFile[copiedFiles.size()]);
+ }
+
public static IPath[] getChanged() {
return (IPath[]) changed.toArray(new IPath[changed.size()]);
}
@@ -97,6 +102,7 @@
IPath path2 = root.append(path);
if( !changed.contains(path2.makeRelative()))
changed.add(path2.makeRelative());
+ copiedFiles.add(mf);
return new IStatus[]{};
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/PublishingFilterTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/PublishingFilterTest.java 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/PublishingFilterTest.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -1,6 +1,7 @@
package org.jboss.ide.eclipse.as.test.publishing.v2;
import java.io.IOException;
+import java.util.ArrayList;
import junit.framework.TestCase;
@@ -8,6 +9,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -89,7 +92,6 @@
"name1", "default");
server = ServerRuntimeUtils.useMock2PublishMethod(server);
IProject project = createProject("module1");
- MockPublishMethod.reset();
ServerPreferences.getInstance().setAutoPublishing(false);
IModule mod = ServerUtil.getModule(project);
@@ -101,7 +103,7 @@
del.setUseSuperclassBehaviour(true);
IModulePathFilter filter = del.getPathFilter(new IModule[]{mod});
IModuleResource[] originalMembers = md.members();
- IModuleResource[] filteredMembers = filter.getFilteredMembers();
+ IModuleResource[] filteredMembers = filter == null ? originalMembers : filter.getFilteredMembers();
int oCount = PublishFilterDirectoryScannerTest.countAllResources(originalMembers);
int fCount = PublishFilterDirectoryScannerTest.countAllResources(filteredMembers);
assertEquals(oCount, fCount);
@@ -137,5 +139,13 @@
new Path("includeme.txt"));
assertNotNull(r);
assertTrue(filter.shouldInclude(r));
+
+ // Test the actual publish
+ MockPublishMethod.reset();
+ server.publish(IServer.PUBLISH_FULL, new NullProgressMonitor());
+ ArrayList<IPath> changed = MockPublishMethod.changed;
+ assertEquals(changed.size(),fCount+1); // addition of 'root'
+
+
}
}
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/IOUtil.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/IOUtil.java 2012-01-24 03:21:51 UTC (rev 38069)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/IOUtil.java 2012-01-24 06:44:13 UTC (rev 38070)
@@ -80,7 +80,7 @@
return 1;
File[] children = root.listFiles();
for( int i = 0; i < children.length; i++ )
- count += countFiles(children[i]);
+ count += countAllResources(children[i]);
return 1 + count;
}
13 years
JBoss Tools SVN: r38069 - trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-01-23 22:21:51 -0500 (Mon, 23 Jan 2012)
New Revision: 38069
Modified:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SmooksXML2XMLSimple.java
Log:
JBQA-5838 - Need to extend timeout for retrieving console output - Smooks examples fail to retrieve output with 20 sec range (e.g., SmooksXML2XMLSimple.java)
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-01-24 03:11:54 UTC (rev 38068)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-01-24 03:21:51 UTC (rev 38069)
@@ -77,13 +77,14 @@
* @return string in server log console that was appended or null if nothing appended
*/
protected String executeClientGetServerOutput(String... clientClass) {
- String text = console.getConsoleText();
+ String text = console.getConsoleText();
SWTBotTreeItem jmsCall = SWTEclipseExt.selectTreeLocation(packageExplorer.show().bot(),clientClass);
eclipse.runTreeItemAsJavaApplication(jmsCall);
bot.sleep(Timing.time5S());
util.waitForNonIgnoredJobs();
console.switchConsole(configuredState.getServer().name);
- String text2 = console.getConsoleText(TIME_5S, TIME_20S, false);
+ //String text2 = console.getConsoleText(TIME_5S, TIME_20S, false);
+ String text2 = console.getConsoleText(TIME_5S, TIME_60S, false); /* https://issues.jboss.org/browse/JBQA-5838 - ldimaggi */
if (text.length()>=text2.length()) {
return null;
}
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SmooksXML2XMLSimple.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SmooksXML2XMLSimple.java 2012-01-24 03:11:54 UTC (rev 38068)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/SmooksXML2XMLSimple.java 2012-01-24 03:21:51 UTC (rev 38069)
@@ -18,6 +18,7 @@
}
@Override
protected void executeExample() {
+ SWTTestExt.servers.removeAllProjectsFromServer();
super.executeExample();
String text = executeClientGetServerOutput(getExampleClientProjectName(),"src","org.jboss.soa.esb.samples.quickstart.transformxml2xmlsimple.test","SendJMSMessage.java");
bot.sleep(Timing.time3S());
13 years
JBoss Tools SVN: r38068 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-01-23 22:11:54 -0500 (Mon, 23 Jan 2012)
New Revision: 38068
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Timing.java
Log:
SWTEclipseExt.java - JBQA-5837 - JBQA ESB tests - resolve issue in SWTEclipseExt.getFormattedTreeNode() - formatting of returned errors
Timing.java, SWTTestExt.java - added 30 second timeout value
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-01-24 02:09:22 UTC (rev 38067)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-01-24 03:11:54 UTC (rev 38068)
@@ -372,6 +372,8 @@
* @return
*/
public static SWTBotTreeItem selectTreeLocation(SWTBot bot, String... path) {
+
+
SWTBot viewBot = bot;
@@ -419,6 +421,9 @@
/* Re-expand the tree - commented out as this does not seem to help */
//theBot.tree().collapseNode(groupLabel);
//theBot.tree().expandNode(groupLabel);
+ //theBot.tree().getTreeItem(groupLabel).click();
+ //theBot.tree().setFocus();
+ //theBot.tree().getTreeItem(groupLabel).expand();
log.info ("Located Problems view - " + theBot.tree().expandNode(groupLabel).expandNode(viewLabel).getText() );
tempItem = theBot.tree().expandNode(groupLabel).expandNode(viewLabel).select();
@@ -426,6 +431,7 @@
theBot.sleep(Timing.time3S());
counter++;
}
+ theBot.sleep(Timing.time30S());
}
@@ -1231,12 +1237,11 @@
//bot.sleep(30000l);
//System.out.println (treeItem.contextMenu("Run As").menu("2 Java Application").getText());
- //bot.sleep(30000l);
- bot.sleep(Timing.time1S());
+ bot.sleep(30000l);
treeItem.contextMenu("Run As").menu("2 Java Application").click();
//runJavaApplication("helloworld_testclient","org.jboss.soa.esb.samples.quickstart.helloworld.test.SendJMSMessage"," ");
- //bot.sleep(30000l); // This is needed to enable the test to run successfully to completion
- bot.waitForShell(IDELabel.Shell.PROGRESS_INFORMATION);
+ bot.sleep(30000l); // This is needed to enable the test to run successfully to completion
+
}
/**
@@ -1400,14 +1405,15 @@
if (item.row()==null) {
return item.getText();
}
- StringBuilder sb = new StringBuilder("");
+ StringBuilder sb = new StringBuilder("");
for (int i=0;i<item.row().columnCount();i++) {
String text = item.row().get(i);
if (text==null) {
sb.append("\"<null>\"");
}
else {
- sb.append(String.format("\"{0}\"", text));
+ //sb.append(String.format("\"{0}\"", text));
+ sb.append(String.format("\"{%s}\"", text)); /* https://issues.jboss.org/browse/JBQA-5837 - ldimaggi */
}
}
return sb.toString();
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-01-24 02:09:22 UTC (rev 38067)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTTestExt.java 2012-01-24 03:11:54 UTC (rev 38068)
@@ -67,6 +67,8 @@
public static int TIME_5S = Timing.time5S();
public static int TIME_10S = Timing.time10S();
public static int TIME_20S = Timing.time20S();
+ public static int TIME_30S = Timing.time30S();
+ public static int TIME_60S = Timing.time60S();
protected void setUp() throws Exception {
super.setUp();
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Timing.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Timing.java 2012-01-24 02:09:22 UTC (rev 38067)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/Timing.java 2012-01-24 03:11:54 UTC (rev 38068)
@@ -38,6 +38,12 @@
public static int time20S() {
return (int) Math.round(20000*multiplier);
}
+ public static int time30S() {
+ return (int) Math.round(30000*multiplier);
+ }
+ public static int time60S() {
+ return (int) Math.round(60000*multiplier);
+ }
public static int time5S() {
return (int) Math.round(5000*multiplier);
}
13 years
JBoss Tools SVN: r38067 - trunk/tests/features/org.jboss.tools.test.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-01-23 21:09:22 -0500 (Mon, 23 Jan 2012)
New Revision: 38067
Modified:
trunk/tests/features/org.jboss.tools.test.feature/build.properties
Log:
https://issues.jboss.org/browse/JBIDE-8997 (CLONE - 2010 in the copyright headers should be replaced by 2012)
fix for tests features copyright text
Modified: trunk/tests/features/org.jboss.tools.test.feature/build.properties
===================================================================
--- trunk/tests/features/org.jboss.tools.test.feature/build.properties 2012-01-24 02:01:55 UTC (rev 38066)
+++ trunk/tests/features/org.jboss.tools.test.feature/build.properties 2012-01-24 02:09:22 UTC (rev 38067)
@@ -1,3 +1,5 @@
-bin.includes = feature.xml
+bin.includes = feature.xml,\
+ feature.properties
src.includes = feature.xml,\
- build.properties
+ build.properties,\
+ feature.properties
13 years
JBoss Tools SVN: r38066 - in trunk/jmx/features: org.jboss.tools.jmx.source.feature and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-01-23 21:01:55 -0500 (Mon, 23 Jan 2012)
New Revision: 38066
Modified:
trunk/jmx/features/org.jboss.tools.jmx.feature/feature.properties
trunk/jmx/features/org.jboss.tools.jmx.source.feature/feature.properties
trunk/jmx/features/org.jboss.tools.jmx.test.feature/feature.properties
trunk/jmx/features/org.jboss.tools.jmx.test.source.feature/feature.properties
Log:
https://issues.jboss.org/browse/JBIDE-8997 (CLONE - 2010 in the copyright headers should be replaced by 2012)
fix for jmx features copyright text
Modified: trunk/jmx/features/org.jboss.tools.jmx.feature/feature.properties
===================================================================
--- trunk/jmx/features/org.jboss.tools.jmx.feature/feature.properties 2012-01-24 02:01:25 UTC (rev 38065)
+++ trunk/jmx/features/org.jboss.tools.jmx.feature/feature.properties 2012-01-24 02:01:55 UTC (rev 38066)
@@ -13,7 +13,7 @@
licenseURL=license.html
copyright=JBoss, Home of Professional Open Source\n\
-Copyright (c) 2006-2011 Red Hat, Inc., and individual contributors as indicated \
+Copyright (c) 2006-2012 Red Hat, Inc., and individual contributors as indicated \
by the @authors tag. See the copyright.txt in the distribution \
for a full listing of individual contributors.
Modified: trunk/jmx/features/org.jboss.tools.jmx.source.feature/feature.properties
===================================================================
--- trunk/jmx/features/org.jboss.tools.jmx.source.feature/feature.properties 2012-01-24 02:01:25 UTC (rev 38065)
+++ trunk/jmx/features/org.jboss.tools.jmx.source.feature/feature.properties 2012-01-24 02:01:55 UTC (rev 38066)
@@ -13,7 +13,7 @@
licenseURL=license.html
copyright=JBoss, Home of Professional Open Source\n\
-Copyright (c) 2006-2011 Red Hat, Inc., and individual contributors as indicated \
+Copyright (c) 2006-2012 Red Hat, Inc., and individual contributors as indicated \
by the @authors tag. See the copyright.txt in the distribution \
for a full listing of individual contributors.
Modified: trunk/jmx/features/org.jboss.tools.jmx.test.feature/feature.properties
===================================================================
--- trunk/jmx/features/org.jboss.tools.jmx.test.feature/feature.properties 2012-01-24 02:01:25 UTC (rev 38065)
+++ trunk/jmx/features/org.jboss.tools.jmx.test.feature/feature.properties 2012-01-24 02:01:55 UTC (rev 38066)
@@ -13,7 +13,7 @@
licenseURL=license.html
copyright=JBoss, Home of Professional Open Source\n\
-Copyright (c) 2006-2011 Red Hat, Inc., and individual contributors as indicated \
+Copyright (c) 2006-2012 Red Hat, Inc., and individual contributors as indicated \
by the @authors tag. See the copyright.txt in the distribution \
for a full listing of individual contributors.
Modified: trunk/jmx/features/org.jboss.tools.jmx.test.source.feature/feature.properties
===================================================================
--- trunk/jmx/features/org.jboss.tools.jmx.test.source.feature/feature.properties 2012-01-24 02:01:25 UTC (rev 38065)
+++ trunk/jmx/features/org.jboss.tools.jmx.test.source.feature/feature.properties 2012-01-24 02:01:55 UTC (rev 38066)
@@ -13,7 +13,7 @@
licenseURL=license.html
copyright=JBoss, Home of Professional Open Source\n\
-Copyright (c) 2006-2011 Red Hat, Inc., and individual contributors as indicated \
+Copyright (c) 2006-2012 Red Hat, Inc., and individual contributors as indicated \
by the @authors tag. See the copyright.txt in the distribution \
for a full listing of individual contributors.
13 years
JBoss Tools SVN: r38065 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-23 21:01:25 -0500 (Mon, 23 Jan 2012)
New Revision: 38065
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
Log:
Add the code which is supposed to be inserted by the Quick Fix into its description https://issues.jboss.org/browse/JBIDE-10636
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-24 01:58:30 UTC (rev 38064)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-24 02:01:25 UTC (rev 38065)
@@ -17,22 +17,25 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+import org.eclipse.ltk.core.refactoring.TextChange;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
+import org.jboss.tools.common.ui.CommonUIPlugin;
/**
* @author Daniel Azarov
@@ -44,6 +47,7 @@
private static final String SPACE = " "; //$NON-NLS-1$
private String label;
+ private String description;
private IMethod method;
private IFile file;
@@ -51,6 +55,7 @@
this.label = MessageFormat.format(CDIUIMessages.ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE, new Object[]{method.getDeclaringType().getElementName()});
this.method = method;
this.file = file;
+ description = getPreview();
}
@Override
@@ -67,68 +72,81 @@
}
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
- IBuffer buffer = compilationUnit.getBuffer();
+ CompilationUnitChange change = getChange(compilationUnit);
- int flag = method.getFlags();
+ if(change.getEdit().hasChildren()){
+ change.perform(new NullProgressMonitor());
+ original.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());
+ }
+ compilationUnit.discardWorkingCopy();
- String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
- // make method public
- int position = method.getSourceRange().getOffset();
- if((flag & Flags.AccPublic) != 0){
- // do nothing
- }else if((flag & Flags.AccPrivate) != 0){
+ private CompilationUnitChange getChange(ICompilationUnit compilationUnit) throws JavaModelException{
+ CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
+
+ MultiTextEdit edit = new MultiTextEdit();
+
+ change.setEdit(edit);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ int flag = method.getFlags();
+
+ String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
+
+ // make method public
+ int position = method.getSourceRange().getOffset();
+
+ if((flag & Flags.AccPublic) == 0){
+ if((flag & Flags.AccPrivate) != 0){
position += text.indexOf(PRIVATE);
- buffer.replace(position, PRIVATE.length(), PUBLIC);
+ edit.addChild(new ReplaceEdit(position, PRIVATE.length(), PUBLIC));
}else if((flag & Flags.AccProtected) != 0){
position += text.indexOf(PROTECTED);
- buffer.replace(position, PROTECTED.length(), PUBLIC);
+ edit.addChild(new ReplaceEdit(position, PROTECTED.length(), PUBLIC));
}else{
String type = Signature.getSignatureSimpleName(method.getReturnType());
position += text.indexOf(type);
buffer.replace(position, 0, PUBLIC+SPACE);
+ edit.addChild(new InsertEdit(position, PUBLIC+SPACE));
}
+ }
+
+ // add @LocalBean annotation
+ MarkerResolutionUtils.addAnnotation(CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME, compilationUnit, method.getDeclaringType(), "", edit);
+
+ return change;
+ }
+
+ private CompilationUnitChange getPreviewChange(){
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
-
- // add @LocalBean annotation
- IType type = compilationUnit.getType(method.getDeclaringType().getElementName());
-
- IAnnotation localAnnotation = EclipseJavaUtil.findAnnotation(type, type, CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME);
- if(localAnnotation == null){
- addImport(CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME, compilationUnit);
-
- final String lineDelim= compilationUnit.findRecommendedLineSeparator();
-
- buffer = compilationUnit.getBuffer();
-
- buffer.replace(type.getSourceRange().getOffset(), 0, "@"+CDIConstants.LOCAL_BEAN_SIMPLE_NAME+lineDelim);
- }
-
- // add method to interface
-
- compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
- compilationUnit.discardWorkingCopy();
-
+ return getChange(original);
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
+ return null;
}
- private void addImport(String qualifiedName, ICompilationUnit compilationUnit) throws JavaModelException{
- if(qualifiedName != null){
- IImportDeclaration importDeclaration = compilationUnit.getImport(qualifiedName);
- if(importDeclaration == null || !importDeclaration.exists())
- compilationUnit.createImport(qualifiedName, null, new NullProgressMonitor());
+ private String getPreview(){
+ TextChange previewChange = getPreviewChange();
+
+ try {
+ return MarkerResolutionUtils.getPreview(previewChange);
+ } catch (CoreException e) {
+ CommonUIPlugin.getDefault().logError(e);
}
-
+ return label;
}
-
+
@Override
public String getDescription() {
- return label;
+ return description;
}
@Override
13 years