JBoss Tools SVN: r37211 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.
by jbosstools-commits@lists.jboss.org
Author: jgargula
Date: 2011-12-12 05:41:01 -0500 (Mon, 12 Dec 2011)
New Revision: 37211
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
Log:
Fixed clearConsole method.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2011-12-12 10:31:35 UTC (rev 37210)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2011-12-12 10:41:01 UTC (rev 37211)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2010 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
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.jboss.tools.ui.bot.ext.view;
import org.apache.log4j.Logger;
@@ -15,73 +15,85 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.hamcrest.core.IsAnything;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
/**
* Manage Console View related tasks
+ *
* @author Vlado Pakan
- *
+ *
*/
public class ConsoleView extends ViewBase {
- public static final int PROBLEMS_DESCRIPTION_COLUMN_INDEX = 0;
- public static final int PROBLEMS_RESOURCE_COLUMN_INDEX = 1;
- public static final int PROBLEMS_PATH_COLUMN_INDEX = 2;
- public static final int PROBLEMS_TYPE_COLUMN_INDEX = 4;
+ public static final int PROBLEMS_DESCRIPTION_COLUMN_INDEX = 0;
+ public static final int PROBLEMS_RESOURCE_COLUMN_INDEX = 1;
+ public static final int PROBLEMS_PATH_COLUMN_INDEX = 2;
+ public static final int PROBLEMS_TYPE_COLUMN_INDEX = 4;
Logger log = Logger.getLogger(ConsoleView.class);
+
public ConsoleView() {
- viewObject = GeneralConsole.LABEL;
+ viewObject = GeneralConsole.LABEL;
}
- /**
- * Returns actual console text
- * @return
- */
- public String getConsoleText(){
-
- show();
- SWTBot viewBot = bot.viewByTitle(viewObject.getName()).bot();
- String consoleText = null;
- try{
- consoleText = viewBot.styledText().getText();
- }catch (WidgetNotFoundException wnfe){
- consoleText = null;
- }
-
- return consoleText;
-
+ /**
+ * Returns actual console text
+ *
+ * @return
+ */
+ public String getConsoleText() {
+
+ show();
+ SWTBot viewBot = bot.viewByTitle(viewObject.getName()).bot();
+ String consoleText = null;
+ try {
+ consoleText = viewBot.styledText().getText();
+ } catch (WidgetNotFoundException wnfe) {
+ consoleText = null;
+ }
+
+ return consoleText;
+
}
- /**
- * Clears console content
- */
- public void clearConsole(){
-
- show();
- SWTBot viewBot = bot.viewByTitle(viewObject.getName()).bot();
- try{
- SWTBotButton clearConsole = viewBot.buttonWithTooltip(IDELabel.ConsoleView.BUTTON_CLEAR_CONSOLE_TOOLTIP).click();
- clearConsole.click();
- }catch (WidgetNotFoundException wnfe){
- // Do nothing Clear Console button is not available
- }
+
+ /**
+ * Clears console content
+ */
+ public void clearConsole() {
+
+ if (getConsoleText() == null || getConsoleText().isEmpty()) {
+ return;
+ }
+
+ try {
+ SWTBotToolbarButton clearConsole = show().toolbarButton(IDELabel.ConsoleView.BUTTON_CLEAR_CONSOLE_TOOLTIP);
+ clearConsole.click();
+ } catch (WidgetNotFoundException wnfe) {
+ log.warn("Console was not cleared.", wnfe);
+ }
}
+
/**
- * switches content displayed in cosole (see 'Display Selected Console' toolbar button)
- * if content cannot be switched (e.g. only one console is displayed in view or console name does not match given
- * String param) return false
- * @param containedInonsoleName String contained in name of console to switch on
+ * switches content displayed in cosole (see 'Display Selected Console'
+ * toolbar button) if content cannot be switched (e.g. only one console is
+ * displayed in view or console name does not match given String param)
+ * return false
+ *
+ * @param containedInonsoleName
+ * String contained in name of console to switch on
*/
public boolean switchConsole(String containedInonsoleName) {
SWTBotView consoleView = show();
- SWTBotToolbarDropDownButton button = consoleView.toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
+ SWTBotToolbarDropDownButton button = consoleView
+ .toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
if (button.isEnabled()) {
- for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>()))
- {
+ for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) {
if (menu.getText().contains(containedInonsoleName)) {
- log.info("Switching consoleView to display '"+menu.getText()+"'. console");
+ log.info("Switching consoleView to display '"
+ + menu.getText() + "'. console");
menu.click();
return true;
}
@@ -89,29 +101,28 @@
}
return false;
}
-
- public String getConsoleText (long sleepTime , long timeOut , boolean quitWhenNoChange){
-
- long estimatedTime = 0;
- SWTBot viewBot = bot.viewByTitle(viewObject.getName()).bot();
- String prevConsoleText = getConsoleText();
- String consoleText = prevConsoleText;
- log.info("Waiting for console text with TimeOut: " + timeOut);
- while ((estimatedTime < timeOut)
- && (!quitWhenNoChange
- || estimatedTime == 0
- || prevConsoleText == null
- || prevConsoleText.length() == 0
- || !prevConsoleText.equals(consoleText))){
- prevConsoleText = consoleText;
- viewBot.sleep(sleepTime);
- estimatedTime += sleepTime;
- consoleText = getConsoleText();
- }
- log.info("Waiting for console text finished");
-
- return consoleText;
-
+
+ public String getConsoleText(long sleepTime, long timeOut, boolean quitWhenNoChange) {
+
+ long estimatedTime = 0;
+ SWTBot viewBot = bot.viewByTitle(viewObject.getName()).bot();
+ String prevConsoleText = getConsoleText();
+ String consoleText = prevConsoleText;
+ log.info("Waiting for console text with TimeOut: " + timeOut);
+ while ((estimatedTime < timeOut)
+ && (!quitWhenNoChange || estimatedTime == 0
+ || prevConsoleText == null
+ || prevConsoleText.length() == 0 || !prevConsoleText
+ .equals(consoleText))) {
+ prevConsoleText = consoleText;
+ viewBot.sleep(sleepTime);
+ estimatedTime += sleepTime;
+ consoleText = getConsoleText();
+ }
+ log.info("Waiting for console text finished");
+
+ return consoleText;
+
}
-
+
}
14 years, 4 months
JBoss Tools SVN: r37206 - trunk/documentation/whatsnew/as.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-12 02:58:13 -0500 (Mon, 12 Dec 2011)
New Revision: 37206
Added:
trunk/documentation/whatsnew/as/as-news-3.3.0.M5.html
Log:
JBIDE-10376 - n&n
Added: trunk/documentation/whatsnew/as/as-news-3.3.0.M5.html
===================================================================
--- trunk/documentation/whatsnew/as/as-news-3.3.0.M5.html (rev 0)
+++ trunk/documentation/whatsnew/as/as-news-3.3.0.M5.html 2011-12-12 07:58:13 UTC (rev 37206)
@@ -0,0 +1,88 @@
+<html>
+
+<head>
+<link rel="stylesheet" href="../whatsnew.css">
+<title>JBoss AS Tools 3.3.0.M5 News</title>
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-17645367-5']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script></head>
+
+<body>
+
+<h1>JBoss AS Tools 3.3.0.M5 What's New</h1>
+
+ <p align="right"><a href="../index.html">< Main Index</a> <a href="../openshift/openshift-news-2.3.0.M5.html">OpenShift Tools></a></p>
+<table border="0" cellpadding="10" cellspacing="0" width="80%">
+
+ <tr>
+ <td colspan="2">
+ <hr/>
+ <h3>Server</h3>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right">
+ <p><b>Support for AS 7.1</b></p>
+ </td>
+ <td valign="top" width="90%">
+ <p>JBoss AS Tools now supports JBoss AS 7.1 beta1b. The support includes a new server adapter type. JBoss AS 7.1 also includes new security features restricting access to the remote management services. The new 7.1 adapter includes methods for storing these credentials. </p>
+ <p><small><a href="https://issues.jboss.org/browse/JBIDE-10292">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr><td colspan="2"><hr /></td></tr>
+ <tr>
+ <td valign="top" align="right">
+ <p><b>Run On Server supported for EAR projects</b></p>
+ </td>
+ <td valign="top" width="90%">
+ <p>Attempting to run an EAR project on a server now will load the url that is most likely to be desired, whereas previously no action was taken on EAR projects</p>
+ <p><small><a href="https://issues.jboss.org/browse/JBIDE-9893">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr><td colspan="2"><hr /></td></tr>
+ <tr>
+ <td valign="top" align="right">
+ <p><b>Deep-Nested project deployment support</b></p>
+ </td>
+ <td valign="top" width="90%">
+ <p>Nesting deployments several layers deep, such as having a utility jar nested inside another utility project, now functions as expected. </p>
+ <p><small><a href="https://issues.jboss.org/browse/JBIDE-8863">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right">
+ <p><b>Actions to load AS Management urls</b></p>
+ </td>
+ <td valign="top" width="90%">
+ <p>The most commonly loaded bundled apps for our servers now appear in the server view's context menu. Simply right-click on the server, select "show in", and you will see options such as the JMX Console, Admin Console, and Web Console.</p>
+ <p><small><a href="https://issues.jboss.org/browse/JBIDE-6828">Related Jira</a></small></p>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="right">
+ <p><b>Usability improvement for "Mark As Deployable" feature</b></p>
+ </td>
+ <td valign="top" width="90%">
+ <p>Some users may have been confusing the "Mark as Deployable" feature with simple deployment done via the Add / Remove Module wizard. When a user now attempts to "Mark as Deployable" a project which is already a deployable module, a dialog is shown, advising them against it unless they are aware of what they are doing. </p>
+ <p><small><a href="https://issues.jboss.org/browse/JBIDE-9995">Related Jira</a></small></p>
+ </td>
+ </tr>
+
+</table>
+
+</body>
+
+</html>
+
+
14 years, 4 months
JBoss Tools SVN: r37205 - branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-12-11 13:15:46 -0500 (Sun, 11 Dec 2011)
New Revision: 37205
Modified:
branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central.discovery/plugin.xml
Log:
https://issues.jboss.org/browse/JBDS-1957 add svnkit client adapter (which brings in jna, svnkit and generic adapter deps); tweak descriptions a little to make them display cleaner on small screens (backport from trunk)
Modified: branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-11 18:10:37 UTC (rev 37204)
+++ branches/jbosstools-3.3.0.M5/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-11 18:15:46 UTC (rev 37205)
@@ -175,12 +175,13 @@
id="org.jboss.tools.central.discovery.scm"
name="Source Control Management"
relevance="60">
- <group id="bundled" />
- <group id="extra" />
+ <group id="org.jboss.tools.central.discovery.scm.git" />
+ <group id="org.jboss.tools.central.discovery.scm.svn" />
</connectorCategory>
<connectorDescriptor
categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.git"
description="Eclipse Team Provider for the Git version control system"
id="org.eclipse.egit"
kind="task"
@@ -197,11 +198,12 @@
</connectorDescriptor>
<connectorDescriptor
categoryId="org.jboss.tools.central.discovery.scm"
- description="Eclipse Team Provider for the Subversion version control system"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Eclipse Team Provider for the Subversion version control system - Core [1/2]"
id="org.tigris.subversion.subclipse"
kind="task"
- license="Free, Subclipse Software User Agreement"
- name="Subclipse SVN Team Provider Core"
+ license="Free, Subclipse License"
+ name="Subclipse - Core"
provider="tigris.org"
siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
<icon
@@ -211,6 +213,23 @@
url="http://subclipse.tigris.org/">
</overview>
</connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Eclipse Team Provider for the Subversion version control system - SVNKit Adapter [2/2]"
+ id="org.tigris.subversion.clientadapter.svnkit.feature"
+ kind="task"
+ license="Free, Subclipse License"
+ name="Subclipse - SVNKit Adapter"
+ provider="tigris.org"
+ siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
+ <icon
+ image32="images/subclipse_32.gif">
+ </icon>
+ <overview
+ url="http://subclipse.tigris.org/">
+ </overview>
+ </connectorDescriptor>
<!-- Testing -->
@@ -262,7 +281,7 @@
kind="task"
license="Free, PMD License"
name="PMD"
- provider="PMD Development Team"
+ provider="PMD Developers"
siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
<icon
image32="images/pmd_32.png">
14 years, 4 months
JBoss Tools SVN: r37204 - trunk/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-12-11 13:10:37 -0500 (Sun, 11 Dec 2011)
New Revision: 37204
Modified:
trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
Log:
https://issues.jboss.org/browse/JBDS-1957 add svnkit client adapter (which brings in jna, svnkit and generic adapter deps); tweak descriptions a little to make them display cleaner on small monitors
Modified: trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-10 23:23:44 UTC (rev 37203)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2011-12-11 18:10:37 UTC (rev 37204)
@@ -175,12 +175,13 @@
id="org.jboss.tools.central.discovery.scm"
name="Source Control Management"
relevance="60">
- <group id="bundled" />
- <group id="extra" />
+ <group id="org.jboss.tools.central.discovery.scm.git" />
+ <group id="org.jboss.tools.central.discovery.scm.svn" />
</connectorCategory>
<connectorDescriptor
categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.git"
description="Eclipse Team Provider for the Git version control system"
id="org.eclipse.egit"
kind="task"
@@ -197,11 +198,12 @@
</connectorDescriptor>
<connectorDescriptor
categoryId="org.jboss.tools.central.discovery.scm"
- description="Eclipse Team Provider for the Subversion version control system"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Eclipse Team Provider for the Subversion version control system - Core [1/2]"
id="org.tigris.subversion.subclipse"
kind="task"
- license="Free, Subclipse Software User Agreement"
- name="Subclipse SVN Team Provider Core"
+ license="Free, Subclipse License"
+ name="Subclipse - Core"
provider="tigris.org"
siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
<icon
@@ -211,6 +213,23 @@
url="http://subclipse.tigris.org/">
</overview>
</connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Eclipse Team Provider for the Subversion version control system - SVNKit Adapter [2/2]"
+ id="org.tigris.subversion.clientadapter.svnkit.feature"
+ kind="task"
+ license="Free, Subclipse License"
+ name="Subclipse - SVNKit Adapter"
+ provider="tigris.org"
+ siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
+ <icon
+ image32="images/subclipse_32.gif">
+ </icon>
+ <overview
+ url="http://subclipse.tigris.org/">
+ </overview>
+ </connectorDescriptor>
<!-- Testing -->
@@ -262,7 +281,7 @@
kind="task"
license="Free, PMD License"
name="PMD"
- provider="PMD Development Team"
+ provider="PMD Developers"
siteUrl="http://download.jboss.org/jbosstools/updates/indigo/extras/">
<icon
image32="images/pmd_32.png">
14 years, 4 months
JBoss Tools SVN: r37203 - trunk/esb/tests/org.jboss.tools.esb.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-12-10 18:23:44 -0500 (Sat, 10 Dec 2011)
New Revision: 37203
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/org.jboss.tools.esb.ui.bot.test.properties
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/requirements.properties
Modified:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml
Log:
* esb.ui.bot.tests can be launched using mvn
Added: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/org.jboss.tools.esb.ui.bot.test.properties
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/org.jboss.tools.esb.ui.bot.test.properties (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/org.jboss.tools.esb.ui.bot.test.properties 2011-12-10 23:23:44 UTC (rev 37203)
@@ -0,0 +1 @@
+ESB=4.7,${jbosstools.test.jbossesb.home}
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml 2011-12-10 16:45:38 UTC (rev 37202)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml 2011-12-10 23:23:44 UTC (rev 37203)
@@ -11,7 +11,13 @@
<artifactId>org.jboss.tools.esb.ui.bot.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
-
+ <properties>
+ <jbosstools.test.jbossesb.home>${requirement.build.root}/jbossesb-4.7</jbosstools.test.jbossesb.home>
+ <swtbot.test.properties.file>./org.jboss.tools.esb.ui.bot.test.properties</swtbot.test.properties.file>
+ <systemProperties>-Djbosstools.test.jbossesb.home=${jbosstools.test.jbossesb.home} -Dswtbot.test.properties.file=${swtbot.test.properties.file}
+ </systemProperties>
+ </properties>
+
<build>
<plugins>
<plugin>
@@ -19,9 +25,11 @@
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<useUIThread>false</useUIThread>
- <skip>${swtbot.test.skip}</skip>
+ <!-- <skip>${swtbot.test.skip}</skip> -->
+ <testSuite>org.jboss.tools.esb.ui.bot.test</testSuite>
+ <testClass>org.jboss.tools.esb.ui.bot.tests.ESBAllBotTests</testClass>
</configuration>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Added: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/requirements.properties
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/requirements.properties (rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/requirements.properties 2011-12-10 23:23:44 UTC (rev 37203)
@@ -0,0 +1 @@
+requirements=jbossesb
14 years, 4 months
JBoss Tools SVN: r37202 - workspace/snjeza/jbossas7-examples.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-12-10 11:45:38 -0500 (Sat, 10 Dec 2011)
New Revision: 37202
Modified:
workspace/snjeza/jbossas7-examples/helloworld.zip
Log:
Modified: workspace/snjeza/jbossas7-examples/helloworld.zip
===================================================================
(Binary files differ)
14 years, 4 months
JBoss Tools SVN: r37201 - trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-12-09 20:55:24 -0500 (Fri, 09 Dec 2011)
New Revision: 37201
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
Log:
Add @SuppressWarnings quick fix https://issues.jboss.org/browse/JBIDE-10187
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2011-12-10 01:20:39 UTC (rev 37200)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2011-12-10 01:55:24 UTC (rev 37201)
@@ -10,43 +10,37 @@
******************************************************************************/
package org.jboss.tools.common.ui.marker;
-import java.util.Collection;
-import java.util.List;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.IAnnotatable;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.ILocalVariable;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ISourceReference;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
-import org.eclipse.jdt.internal.ui.preferences.ProblemSeveritiesConfigurationBlock;
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageNode;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.ui.CommonUIMessages;
import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.osgi.service.prefs.BackingStoreException;
/**
* @author Daniel Azarov
@@ -55,9 +49,8 @@
IMarkerResolution2 {
public static final String SPACE = " "; //$NON-NLS-1$
public static final String AT = "@"; //$NON-NLS-1$
- private static final String JAVA_COMPILER_ID="org.eclipse.jdt.ui.propertyPages.CompliancePreferencePage"; //$NON-NLS-1$
- private static final String PROBLEM_SEVERITIES_ID="org.eclipse.jdt.ui.propertyPages.ProblemSeveritiesPreferencePage"; //$NON-NLS-1$
-
+ private static final String PROBLEM_ID = JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN;
+ private SP preferences = new SP();
private IFile file;
private IJavaElement element;
@@ -76,6 +69,12 @@
}
public void run(IMarker marker) {
+ addSuppressWarningsAnnotation();
+
+ disablePreference();
+ }
+
+ private void addSuppressWarningsAnnotation(){
try {
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
ICompilationUnit compilationUnit;
@@ -90,11 +89,54 @@
} catch (CoreException e) {
CommonUIPlugin.getDefault().logError(e);
}
-
- JavaCore.getPlugin().getPluginPreferences().setValue(JavaCore.COMPILER_PB_UNHANDLED_WARNING_TOKEN, JavaCore.IGNORE);
- JavaCore.getPlugin().savePluginPreferences();
}
+ private void disablePreference(){
+ String value = preferences.getProjectPreference(file.getProject(), PROBLEM_ID);
+ if(!preferences.IGNORE.equals(value)){
+ MessageDialog dialog = null;
+ dialog = new MessageDialog(getShell(), label, null,
+ "Do you want to disable 'Unsupported @SuppressWarnings' error/warning on the Workspace or only on the project '"+file.getProject().getName()+"'",
+ MessageDialog.QUESTION_WITH_CANCEL,
+ new String[]{"Cancel", "Workspace", file.getProject().getName()},
+ 0);
+ int result = dialog.open();
+ if(result == 1){
+ JavaCore.getPlugin().getPluginPreferences().setValue(PROBLEM_ID, preferences.IGNORE);
+ JavaCore.getPlugin().savePluginPreferences();
+// IEclipsePreferences ePrefs = preferences.getDefaultPreferences();
+// ePrefs.put(PROBLEM_ID, preferences.IGNORE);
+// try {
+// ePrefs.flush();
+// } catch (BackingStoreException e) {
+// CommonUIPlugin.getDefault().logError(e);
+// }
+ }else if(result == 2){
+ IEclipsePreferences ePrefs = preferences.getProjectPreferences(file.getProject());
+ ePrefs.put(PROBLEM_ID, preferences.IGNORE);
+ try {
+ ePrefs.flush();
+ } catch (BackingStoreException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+ }
+
+ }
+ }
+
+ private static Shell getShell() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ if (windows.length > 0) {
+ return windows[0].getShell();
+ }
+ }
+ else {
+ return window.getShell();
+ }
+ return null;
+ }
public String getDescription() {
return label;
}
@@ -103,7 +145,7 @@
return JavaPlugin.getImageDescriptorRegistry().get(JavaPluginImages.DESC_OBJS_ANNOTATION);
}
- public static void addAnnotation(String name, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
+ private static void addAnnotation(String name, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
if(workingCopyElement == null){
return;
@@ -114,15 +156,11 @@
ISourceReference workingCopySourceReference = (ISourceReference) workingCopyElement;
- //IAnnotation annotation = findAnnotation(workingCopyMember, name);
- //if(annotation != null && annotation.exists())
- // return;
-
IBuffer buffer = compilationUnit.getBuffer();
String str = AT+name;
- if(workingCopySourceReference instanceof IType){
+ if(!(workingCopySourceReference instanceof ILocalVariable)){
str += compilationUnit.findRecommendedLineSeparator();
}else{
str += SPACE;
@@ -132,7 +170,7 @@
}
@SuppressWarnings("unchecked")
- public static <T extends IJavaElement> T findWorkingCopy(ICompilationUnit compilationUnit, T element) throws JavaModelException{
+ private static <T extends IJavaElement> T findWorkingCopy(ICompilationUnit compilationUnit, T element) throws JavaModelException{
if(element instanceof IAnnotation){
IJavaElement parent = findWorkingCopy(compilationUnit, element.getParent());
if(parent instanceof IAnnotatable){
@@ -159,4 +197,25 @@
}
}
return null;
- }}
+ }
+
+ static class SP extends SeverityPreferences{
+
+ @Override
+ protected Set<String> getSeverityOptionNames() {
+ return null;
+ }
+
+ @Override
+ protected String createSeverityOption(String shortName) {
+ return null;
+ }
+
+ @Override
+ protected String getPluginId() {
+ return JavaCore.PLUGIN_ID;
+ }
+
+ }
+
+}
14 years, 4 months