JBoss Tools SVN: r42906 - branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-08 05:11:08 -0400 (Wed, 08 Aug 2012)
New Revision: 42906
Modified:
branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
Log:
Fixed context menu.
Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2012-08-08 09:08:30 UTC (rev 42905)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java 2012-08-08 09:11:08 UTC (rev 42906)
@@ -1,16 +1,28 @@
package org.jboss.tools.ui.bot.ext.view;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.hamcrest.Matchers.allOf;
+
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.ContextMenuFinder;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.Timing;
@@ -337,7 +349,7 @@
public void openWebPage(String serverName){
SWTBot bot = show().bot();
SWTBotTree serversTree = bot.tree();
- SWTBotTreeItem server = findServerByName(serversTree, serverName);
+ SWTBotTreeItem server = new SWTBotTreeItemWithContextMenu(findServerByName(serversTree, serverName));
server.contextMenu("Web Browser").click();
}
@@ -346,7 +358,7 @@
SWTBot bot = show().bot();
SWTBotTree serversTree = bot.tree();
SWTBotTreeItem server = findServerByName(serversTree, serverName);
- SWTBotTreeItem project = getProjectNode(server, projectName);
+ SWTBotTreeItem project = new SWTBotTreeItemWithContextMenu(getProjectNode(server, projectName));
project.contextMenu("Web Browser").click();
}
@@ -397,4 +409,59 @@
return "Expected the tree item to be decorated with separator '" + separator + "'";
}
}
+
+ class SWTBotTreeItemWithContextMenu extends SWTBotTreeItem {
+
+ private Tree tree;
+
+ public SWTBotTreeItemWithContextMenu(final SWTBotTreeItem treeItem)
+ throws WidgetNotFoundException {
+ super(treeItem.widget);
+
+ this.tree = syncExec(new WidgetResult<Tree>() {
+ public Tree run() {
+ return treeItem.widget.getParent();
+ }
+ });
+ }
+
+ @Override
+ public SWTBotMenu contextMenu(String text) {
+ select();
+ notifyTree(SWT.MouseDown, createMouseEvent(0, 0, 3, 0, 1));
+ notifyTree(SWT.MouseUp, createMouseEvent(0, 0, 3, 0, 1));
+ notifyTree(SWT.MenuDetect);
+ return contextMenu(tree, text);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected SWTBotMenu contextMenu(final Control control, final String text) {
+ Matcher<MenuItem> withMnemonic = withMnemonic(text);
+ final Matcher<MenuItem> matcher = allOf(widgetOfType(MenuItem.class), withMnemonic);
+ final ContextMenuFinder menuFinder = new ContextMenuFinder(control);
+ return new SWTBotMenu(getMenu(menuFinder.findMenus(matcher)), matcher);
+ }
+
+ private void notifyTree(int eventType) {
+ notify(eventType, createEvent(), tree);
+ }
+
+ private void notifyTree(int eventType, Event event) {
+ notify(eventType, event, tree);
+ }
+
+ private MenuItem getMenu(List<MenuItem> items){
+ for (MenuItem item : items){
+ if (!item.isDisposed()){
+ return item;
+ }
+ }
+
+ if (items.isEmpty()){
+ throw new WidgetNotFoundException("Widget menuItem has not been found");
+ } else {
+ throw new IllegalStateException("All menu items have been disposed");
+ }
+ }
+ }
}
12 years, 5 months
JBoss Tools SVN: r42905 - trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/template.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-08 05:08:30 -0400 (Wed, 08 Aug 2012)
New Revision: 42905
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/template/DeployJSPProjectTemplate.java
Log:
Changed the order of asserts so that they wait until the specified text is displayed in the console first.
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/template/DeployJSPProjectTemplate.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/template/DeployJSPProjectTemplate.java 2012-08-08 07:42:21 UTC (rev 42904)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/template/DeployJSPProjectTemplate.java 2012-08-08 09:08:30 UTC (rev 42905)
@@ -8,7 +8,6 @@
import org.jboss.ide.eclipse.as.ui.bot.test.wizard.ImportProjectWizard;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.SWTUtilExt;
-import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
import org.jboss.tools.ui.bot.ext.matcher.console.ConsoleOutputMatcher;
import org.jboss.tools.ui.bot.ext.view.ServersView;
@@ -47,12 +46,12 @@
ServersView serversView = new ServersView();
serversView.addProjectToServer(PROJECT_NAME, configuredState.getServer().name);
- // web
- serversView.openWebPage(configuredState.getServer().name, PROJECT_NAME);
- assertThat("Hello tests!", new PageSourceMatcher());
// console
assertThat(getConsoleMessage(), new ConsoleOutputMatcher(TaskDuration.NORMAL));
assertThat("Exception:", not(new ConsoleOutputMatcher()));
+ // web
+ serversView.openWebPage(configuredState.getServer().name, PROJECT_NAME);
+ assertThat("Hello tests!", new PageSourceMatcher());
// view
assertTrue("Server contains project", serversView.containsProject(configuredState.getServer().name, PROJECT_NAME));
assertEquals("Started", serversView.getServerStatus(configuredState.getServer().name));
12 years, 5 months
JBoss Tools SVN: r42904 - in trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui: providers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-08 03:42:21 -0400 (Wed, 08 Aug 2012)
New Revision: 42904
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
Log:
JBIDE-11878 and JBIDE-11876 to trunk
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2012-08-08 07:39:41 UTC (rev 42903)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2012-08-08 07:42:21 UTC (rev 42904)
@@ -111,6 +111,11 @@
public static String EnableDefaultExcludes;
public static String ConfigureWorkspacePrefs;
+ public static String deleteNodeMBTitle;
+ public static String deleteNodeMBDesc;
+ public static String deleteNodeMBToggle;
+
+
static {
NLS.initializeMessages("org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages", ArchivesUIMessages.class); //$NON-NLS-1$
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2012-08-08 07:39:41 UTC (rev 42903)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2012-08-08 07:42:21 UTC (rev 42904)
@@ -92,4 +92,8 @@
ShowAllProjects=Show all projects that contain packages
FilesetPreferences=Fileset Preferences
EnableDefaultExcludes=Enable Default Excludes
-ConfigureWorkspacePrefs=Configure Workspace Preferences...
\ No newline at end of file
+ConfigureWorkspacePrefs=Configure Workspace Preferences...
+
+deleteNodeMBTitle=Delete this node?
+deleteNodeMBDesc=Are you sure you want to delete this node? This cannot be undone.
+deleteNodeMBToggle=Always delete without prompting.
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2012-08-08 07:39:41 UTC (rev 42903)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2012-08-08 07:42:21 UTC (rev 42904)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.ui.providers;
+import java.io.IOException;
import java.util.Arrays;
import org.eclipse.core.resources.IProject;
@@ -23,17 +24,24 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
@@ -49,6 +57,7 @@
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
import org.jboss.ide.eclipse.archives.ui.NodeContribution;
+import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
import org.jboss.ide.eclipse.archives.ui.actions.BuildAction;
import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
@@ -63,6 +72,7 @@
public static final String INITIAL_SEPARATOR_ID = "org.jboss.ide.eclipse.archives.ui.providers.initialSeparator"; //$NON-NLS-1$
public static final String END_ADD_CHILD_SEPARATOR_ID = "org.jboss.ide.eclipse.archives.ui.providers.endAddChildSeparator"; //$NON-NLS-1$
+ private static final String DELETE_NODE_PERMISSION_TOGGLE = "ArchivesActionProvider.DeleteNodePreferenceKey"; //$NON-NLS-1$
private MenuManager newPackageManager;
private NodeContribution[] nodePopupMenuContributions;
@@ -70,8 +80,18 @@
private Action editAction, deleteAction, newFolderAction, newFilesetAction;
private Action buildAction;
private ICommonViewerSite site;
-
+ private KeyListener deleteKeyListener;
+
public ArchivesActionProvider() {
+ deleteKeyListener = new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if( e.keyCode == SWT.DEL ) {
+ deleteSelectedNode();
+ }
+ }
+ public void keyReleased(KeyEvent e) {
+ }
+ };
}
public void init(ICommonActionExtensionSite aSite) {
@@ -81,6 +101,8 @@
site = aSite.getViewSite();
createActions();
newPackageManager = new MenuManager(ArchivesUIMessages.ProjectPackagesView_newPackageMenu_label, NEW_PACKAGE_MENU_ID);
+ Control viewerControl = aSite.getStructuredViewer().getControl();
+ viewerControl.addKeyListener(deleteKeyListener);
}
public void fillContextMenu(IMenuManager manager) {
@@ -378,7 +400,7 @@
private void deleteSelectedNode () {
IArchiveNode node = getSelectedNode(site);
- if (node != null) {
+ if (node != null && approveDeletion(node)) {
final IArchiveNode parent = (IArchiveNode) node.getParent();
parent.removeChild(node);
SaveArchivesJob job = new SaveArchivesJob(parent.getProjectPath());
@@ -386,6 +408,33 @@
}
}
+ private boolean approveDeletion(IArchiveNode node) {
+ if( node != null ) {
+ IPreferenceStore store = PackagesUIPlugin.getDefault().getPreferenceStore();
+ String current = store.getString(DELETE_NODE_PERMISSION_TOGGLE);
+ boolean doNotPrompt = Boolean.parseBoolean(current);
+ if( doNotPrompt )
+ return true;
+ MessageDialogWithToggle d =
+ MessageDialogWithToggle.openYesNoQuestion(site.getShell(),
+ ArchivesUIMessages.deleteNodeMBTitle,
+ ArchivesUIMessages.deleteNodeMBDesc,
+ ArchivesUIMessages.deleteNodeMBToggle,
+ false, store, DELETE_NODE_PERMISSION_TOGGLE);
+ int ret = d.getReturnCode();
+ boolean toggle = d.getToggleState();
+ if( ret == 2 ) { // ok pressed
+ store.setValue(DELETE_NODE_PERMISSION_TOGGLE, new Boolean(toggle).toString());
+ try {
+ ((ScopedPreferenceStore)store).save();
+ } catch(IOException ioe) {
+ // ignore
+ }
+ return true;
+ }
+ }
+ return false;
+ }
public static IArchiveNode getSelectedNode (ICommonViewerSite site) {
Object selected = getSelectedObject(site);
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2012-08-08 07:39:41 UTC (rev 42903)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2012-08-08 07:42:21 UTC (rev 42904)
@@ -82,8 +82,7 @@
if( part == instance )
return;
if (selection == null || selection.isEmpty()) {
- getInitialInput();
- jiggleViewerInput();
+ return;
}
if (!(selection instanceof IStructuredSelection))
return;
12 years, 5 months
JBoss Tools SVN: r42903 - in branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui: providers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-08 03:39:41 -0400 (Wed, 08 Aug 2012)
New Revision: 42903
Modified:
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
Log:
JBIDE-11878 and JBIDE-11876 to maintenance
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2012-08-08 06:56:38 UTC (rev 42902)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2012-08-08 07:39:41 UTC (rev 42903)
@@ -111,6 +111,11 @@
public static String EnableDefaultExcludes;
public static String ConfigureWorkspacePrefs;
+ public static String deleteNodeMBTitle;
+ public static String deleteNodeMBDesc;
+ public static String deleteNodeMBToggle;
+
+
static {
NLS.initializeMessages("org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages", ArchivesUIMessages.class); //$NON-NLS-1$
}
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2012-08-08 06:56:38 UTC (rev 42902)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2012-08-08 07:39:41 UTC (rev 42903)
@@ -92,4 +92,8 @@
ShowAllProjects=Show all projects that contain packages
FilesetPreferences=Fileset Preferences
EnableDefaultExcludes=Enable Default Excludes
-ConfigureWorkspacePrefs=Configure Workspace Preferences...
\ No newline at end of file
+ConfigureWorkspacePrefs=Configure Workspace Preferences...
+
+deleteNodeMBTitle=Delete this node?
+deleteNodeMBDesc=Are you sure you want to delete this node? This cannot be undone.
+deleteNodeMBToggle=Always delete without prompting.
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2012-08-08 06:56:38 UTC (rev 42902)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/providers/ArchivesActionProvider.java 2012-08-08 07:39:41 UTC (rev 42903)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.ui.providers;
+import java.io.IOException;
import java.util.Arrays;
import org.eclipse.core.resources.IProject;
@@ -23,17 +24,24 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
@@ -49,6 +57,7 @@
import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
import org.jboss.ide.eclipse.archives.ui.ExtensionManager;
import org.jboss.ide.eclipse.archives.ui.NodeContribution;
+import org.jboss.ide.eclipse.archives.ui.PackagesUIPlugin;
import org.jboss.ide.eclipse.archives.ui.actions.BuildAction;
import org.jboss.ide.eclipse.archives.ui.actions.NewArchiveAction;
import org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject;
@@ -63,6 +72,7 @@
public static final String INITIAL_SEPARATOR_ID = "org.jboss.ide.eclipse.archives.ui.providers.initialSeparator"; //$NON-NLS-1$
public static final String END_ADD_CHILD_SEPARATOR_ID = "org.jboss.ide.eclipse.archives.ui.providers.endAddChildSeparator"; //$NON-NLS-1$
+ private static final String DELETE_NODE_PERMISSION_TOGGLE = "ArchivesActionProvider.DeleteNodePreferenceKey"; //$NON-NLS-1$
private MenuManager newPackageManager;
private NodeContribution[] nodePopupMenuContributions;
@@ -70,8 +80,18 @@
private Action editAction, deleteAction, newFolderAction, newFilesetAction;
private Action buildAction;
private ICommonViewerSite site;
-
+ private KeyListener deleteKeyListener;
+
public ArchivesActionProvider() {
+ deleteKeyListener = new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if( e.keyCode == SWT.DEL ) {
+ deleteSelectedNode();
+ }
+ }
+ public void keyReleased(KeyEvent e) {
+ }
+ };
}
public void init(ICommonActionExtensionSite aSite) {
@@ -81,6 +101,8 @@
site = aSite.getViewSite();
createActions();
newPackageManager = new MenuManager(ArchivesUIMessages.ProjectPackagesView_newPackageMenu_label, NEW_PACKAGE_MENU_ID);
+ Control viewerControl = aSite.getStructuredViewer().getControl();
+ viewerControl.addKeyListener(deleteKeyListener);
}
public void fillContextMenu(IMenuManager manager) {
@@ -378,7 +400,7 @@
private void deleteSelectedNode () {
IArchiveNode node = getSelectedNode(site);
- if (node != null) {
+ if (node != null && approveDeletion(node)) {
final IArchiveNode parent = (IArchiveNode) node.getParent();
parent.removeChild(node);
SaveArchivesJob job = new SaveArchivesJob(parent.getProjectPath());
@@ -386,6 +408,33 @@
}
}
+ private boolean approveDeletion(IArchiveNode node) {
+ if( node != null ) {
+ IPreferenceStore store = PackagesUIPlugin.getDefault().getPreferenceStore();
+ String current = store.getString(DELETE_NODE_PERMISSION_TOGGLE);
+ boolean doNotPrompt = Boolean.parseBoolean(current);
+ if( doNotPrompt )
+ return true;
+ MessageDialogWithToggle d =
+ MessageDialogWithToggle.openYesNoQuestion(site.getShell(),
+ ArchivesUIMessages.deleteNodeMBTitle,
+ ArchivesUIMessages.deleteNodeMBDesc,
+ ArchivesUIMessages.deleteNodeMBToggle,
+ false, store, DELETE_NODE_PERMISSION_TOGGLE);
+ int ret = d.getReturnCode();
+ boolean toggle = d.getToggleState();
+ if( ret == 2 ) { // ok pressed
+ store.setValue(DELETE_NODE_PERMISSION_TOGGLE, new Boolean(toggle).toString());
+ try {
+ ((ScopedPreferenceStore)store).save();
+ } catch(IOException ioe) {
+ // ignore
+ }
+ return true;
+ }
+ }
+ return false;
+ }
public static IArchiveNode getSelectedNode (ICommonViewerSite site) {
Object selected = getSelectedObject(site);
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2012-08-08 06:56:38 UTC (rev 42902)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesCommonView.java 2012-08-08 07:39:41 UTC (rev 42903)
@@ -82,8 +82,7 @@
if( part == instance )
return;
if (selection == null || selection.isEmpty()) {
- getInitialInput();
- jiggleViewerInput();
+ return;
}
if (!(selection instanceof IStructuredSelection))
return;
12 years, 5 months
JBoss Tools SVN: r42902 - trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-08 02:56:38 -0400 (Wed, 08 Aug 2012)
New Revision: 42902
Modified:
trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties
Log:
dummy bot test build.properties updated
Modified: trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties
===================================================================
--- trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties 2012-08-08 05:22:53 UTC (rev 42901)
+++ trunk/tests/tests/org.jboss.tools.dummy.ui.bot.test/build.properties 2012-08-08 06:56:38 UTC (rev 42902)
@@ -1,5 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .,\
- src/log4j.xml
+ .
12 years, 5 months
JBoss Tools SVN: r42901 - branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-08 01:22:53 -0400 (Wed, 08 Aug 2012)
New Revision: 42901
Modified:
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
Log:
JBIDE-12361 archives portion to maintenance
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2012-08-08 05:22:30 UTC (rev 42900)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/DirectoryScannerFactory.java 2012-08-08 05:22:53 UTC (rev 42901)
@@ -84,6 +84,9 @@
protected ScannableFileSet fs;
protected ArrayList<FileWrapper> matches;
protected HashMap<String, ArrayList<FileWrapper>> matchesMap;
+
+ /* Folders that are required to be created due to a descendent, but are not fully included */
+ protected HashMap<String, ArrayList<FileWrapper>> requiredFolders;
public DirectoryScannerExtension(ScannableFileSet fs) {
this.fs = fs;
String includes = fs.includes == null ? "" : fs.includes; //$NON-NLS-1$
@@ -95,6 +98,7 @@
workspaceRelative = fs.inWorkspace;
matches = new ArrayList<FileWrapper>();
matchesMap = new HashMap<String, ArrayList<FileWrapper>>();
+ requiredFolders = new HashMap<String, ArrayList<FileWrapper>>();
setBasedir2(fs.rawPath);
}
@@ -139,8 +143,10 @@
.getVFS().getWorkspaceChildren(workspaceRelative);
IPath[] childrenAbsolute = globalize(childrenWorkspace);
File[] files = new File[childrenAbsolute.length];
+ IPath parentRootFSRelative = ((FileWrapper)file).getRootArchiveRelative();
for( int i = 0; i < files.length; i++ ) {
- files[i] = new FileWrapper(childrenAbsolute[i].toFile(), childrenWorkspace[i], fs.rootArchiveRelativePath);
+ files[i] = new FileWrapper(childrenAbsolute[i].toFile(), childrenWorkspace[i],
+ parentRootFSRelative.append(childrenWorkspace[i].lastSegment()));
}
return files;
}
@@ -171,15 +177,29 @@
f2.setFilesetRelative(relative);
if( f.isFile() ) {
matches.add(f2);
- ArrayList<FileWrapper> l = matchesMap.get(f2);
- if( l == null ) {
- l = new ArrayList<FileWrapper>();
- matchesMap.put(((FileWrapper)f).getAbsolutePath(), l);
- }
- l.add(f2);
+ addMatchToMap(f2, matchesMap);
+ if( fs.inWorkspace )
+ ensureRequiredFoldersIncluded(f2);
}
}
}
+ protected void addMatchToMap(FileWrapper f2, HashMap<String, ArrayList<FileWrapper>> map) {
+ ArrayList<FileWrapper> l = map.get(f2);
+ if( l == null ) {
+ l = new ArrayList<FileWrapper>();
+ map.put(f2.getAbsolutePath(), l);
+ }
+ l.add(f2);
+ }
+ protected void ensureRequiredFoldersIncluded(FileWrapper includedFile) {
+ FileWrapper tmpParentWrapper = includedFile.getParentFile();
+ while(tmpParentWrapper != null ) {
+ includedFile = tmpParentWrapper;
+ if( requiredFolders.get(includedFile.getAbsolutePath()) != null )
+ return; // all done
+ addMatchToMap(includedFile, requiredFolders);
+ }
+ }
protected boolean isSelected(String name, File file) {
return super.isSelected(name, file) && file.isFile();
@@ -195,6 +215,10 @@
return matchesMap;
}
+ public HashMap<String, ArrayList<FileWrapper>> getRequiredFolderMap() {
+ return requiredFolders;
+ }
+
public static class FileWrapper extends File {
// The actual source file
File f;
@@ -232,8 +256,11 @@
}
public IPath getRootArchiveRelative() {
- if( rootArchiveRelativePath != null )
+ if( rootArchiveRelativePath != null ) {
+ if( fsRelative == null )
+ return rootArchiveRelativePath;
return rootArchiveRelativePath.append(fsRelative);
+ }
return null;
}
@@ -244,6 +271,23 @@
}
return false;
}
+ @Override
+ public FileWrapper getParentFile() {
+ if( f.getParentFile() == null )
+ return null;
+ if( path.segmentCount() == 0 )
+ return null;
+ if( rootArchiveRelativePath.segmentCount() == 0 )
+ return null;
+ IPath p = new Path(fsRelative);
+ if( p.segmentCount() == 0 )
+ return null;
+
+ FileWrapper ret = new FileWrapper(f.getParentFile(),
+ path.removeLastSegments(1), rootArchiveRelativePath.removeLastSegments(1));
+ ret.setFilesetRelative(p.removeLastSegments(1).toString());
+ return ret;
+ }
}
public boolean couldBeIncluded(String path, boolean inWorkspace) {
12 years, 5 months
JBoss Tools SVN: r42900 - in branches/jbosstools-3.3.x/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-08 01:22:30 -0400 (Wed, 08 Aug 2012)
New Revision: 42900
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
Log:
JBIDE-12361 astools portion to maintenance
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java 2012-08-08 00:55:06 UTC (rev 42899)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java 2012-08-08 05:22:30 UTC (rev 42900)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -19,8 +23,8 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.as.wtp.core.util.ResourceFilter;
import org.jboss.ide.eclipse.as.wtp.core.util.ResourceListVirtualFolder;
import org.jboss.ide.eclipse.as.wtp.core.vcf.AbstractFilesetVirtualComponent;
@@ -96,12 +100,33 @@
scanner = DirectoryScannerFactory.createDirectoryScanner(
rootFolderPath, new Path(""), //$NON-NLS-1$
includes, excludes, getProject().getName(), true,
- IArchiveModelRootNode.DESCRIPTOR_VERSION_1_3, false);
+ IArchiveModelRootNode.DESCRIPTOR_VERSION_1_3, true);
}
public boolean accepts(IResource resource) {
- boolean b = scanner.couldBeIncluded(resource.getFullPath().toString(), true);
- return b;
+ String absolutePath = resource.getLocation().toFile().getAbsolutePath();
+ ArrayList<DirectoryScannerExtension.FileWrapper> sum = getAllMatches(absolutePath);
+ if( sum.size() > 0 ) {
+ DirectoryScannerExtension.FileWrapper tmp;
+ Iterator<DirectoryScannerExtension.FileWrapper> i = sum.iterator();
+ while(i.hasNext()) {
+ tmp = i.next();
+ if( tmp.getWrapperPath().equals(resource.getFullPath()))
+ return true;
+ }
+ }
+ return false;
}
+ private ArrayList<DirectoryScannerExtension.FileWrapper> getAllMatches(String absolutePath) {
+ HashMap<String, ArrayList<DirectoryScannerExtension.FileWrapper>> matchedFiles = scanner.getMatchedMap();
+ HashMap<String, ArrayList<DirectoryScannerExtension.FileWrapper>> requiredFolders = scanner.getRequiredFolderMap();
+ ArrayList<DirectoryScannerExtension.FileWrapper> sum = new ArrayList<DirectoryScannerExtension.FileWrapper>();
+
+ if( matchedFiles.get(absolutePath) != null )
+ sum.addAll(matchedFiles.get(absolutePath));
+ if( requiredFolders.get(absolutePath) != null )
+ sum.addAll(requiredFolders.get(absolutePath));
+ return sum;
+ }
}
}
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2012-08-08 00:55:06 UTC (rev 42899)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2012-08-08 05:22:30 UTC (rev 42900)
@@ -26,6 +26,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerAttributes;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
@@ -64,6 +65,7 @@
return server.getAttribute(IDeployableServer.SERVER_MODE, defaultType);
}
+ @Deprecated
public static DeploymentPreferences loadPreferencesFromFile(IServer server) {
File f = getFile(server);
if( f.exists()) {
@@ -77,7 +79,7 @@
return null;
}
- public static DeploymentPreferences loadPreferencesFromServer(IServer server) {
+ public static DeploymentPreferences loadPreferencesFromServer(IServerAttributes server) {
String xml = ((Server)server).getAttribute(DEPLOYMENT_PREFERENCES_KEY, (String)null);
ByteArrayInputStream bis = null;
if( xml != null ) {
@@ -86,6 +88,7 @@
return new DeploymentPreferences(bis);
}
+ @Deprecated
public static void savePreferences(IServer server, DeploymentPreferences prefs) throws IOException {
File f = getFile(server);
prefs.getMemento().saveToFile(f.getAbsolutePath());
@@ -185,17 +188,23 @@
}
public DeploymentModulePrefs getModulePrefs(IModule module) {
- return children.get(module.getId());
+ return getModulePrefs(module.getId());
}
+ public DeploymentModulePrefs getModulePrefs(String id) {
+ return children.get(id);
+ }
public DeploymentModulePrefs getOrCreateModulePrefs(IModule module) {
- if( children.get(module.getId()) == null ) {
+ return getOrCreateModulePrefs(module.getId());
+ }
+ public DeploymentModulePrefs getOrCreateModulePrefs(String id) {
+ if( children.get(id) == null ) {
IMemento childMemento = memento.createChild("module"); //$NON-NLS-1$
- childMemento.putString("id", module.getId()); //$NON-NLS-1$
- children.put(module.getId(),
- new DeploymentModulePrefs(module.getId(),
+ childMemento.putString("id", id); //$NON-NLS-1$
+ children.put(id,
+ new DeploymentModulePrefs(id,
childMemento));
}
- return children.get(module.getId());
+ return children.get(id);
}
public String getProperty(String key) {
@@ -262,15 +271,19 @@
}
public static void savePreferencesToServerWorkingCopy(ServerAttributeHelper helper, DeploymentPreferences prefs) {
+ savePreferencesToServerWorkingCopy(helper.getWorkingCopy(), prefs);
+ }
+
+ public static void savePreferencesToServerWorkingCopy(IServerWorkingCopy wc, DeploymentPreferences prefs) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DeploymentPreferenceLoader.savePreferences(bos, prefs);
String asXML = new String(bos.toByteArray());
- helper.setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
+ wc.setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
} catch(IOException ioe) {
// Should never happen since this is a simple byte array output stream
JBossServerCorePlugin.log(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- "Could not save module deployment preferences to server " + helper.getServer().getName(), ioe)); //$NON-NLS-1$
+ "Could not save module deployment preferences to server " + wc.getOriginal().getName(), ioe)); //$NON-NLS-1$
}
}
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2012-08-08 00:55:06 UTC (rev 42899)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2012-08-08 05:22:30 UTC (rev 42900)
@@ -104,7 +104,7 @@
return jbServer;
}
- public static IDeployableServer getDeployableServer(IServer server) {
+ public static IDeployableServer getDeployableServer(IServerAttributes server) {
if (server == null) {
return null;
}
12 years, 5 months
JBoss Tools SVN: r42899 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2012-08-07 20:55:06 -0400 (Tue, 07 Aug 2012)
New Revision: 42899
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-10611 As-you-type CDI validation
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2012-08-08 00:18:53 UTC (rev 42898)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2012-08-08 00:55:06 UTC (rev 42899)
@@ -296,7 +296,6 @@
} catch(CoreException e) {
CDICorePlugin.getDefault().logError(e);
}
-
}
private void addLinkedResourcesForUnknownType(IFile beansXml, String typeName) {
@@ -432,10 +431,12 @@
private abstract class AbstractTypeValidator implements TypeValidator {
+ @Override
public String getTypeElementName() {
return "class"; //$NON-NLS-1$
}
+ @Override
public String validateType(CDICoreValidator.CDIValidationContext context, IType type) throws JavaModelException {
if(!validateKindOfType(type)) {
return getIllegalTypeErrorMessage();
@@ -477,35 +478,43 @@
private class AlternativeClassValidator extends AbstractTypeValidator {
+ @Override
public boolean validateSourceType(CDICoreValidator.CDIValidationContext context, IType type) {
IClassBean classBean = context.getCdiProject().getBeanClass(type);
return classBean!=null && classBean.isAlternative();
}
+ @Override
public String getParrentElementname() {
return "alternatives"; //$NON-NLS-1$
}
+ @Override
public String getEmptyTypeErrorMessage() {
return CDIValidationMessages.EMPTY_ALTERNATIVE_BEAN_CLASS_NAME;
}
-
+
+ @Override
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME;
}
-
+
+ @Override
public int getUnknownTypeErrorMessageId() {
return CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME_ID;
}
+ @Override
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS;
}
+ @Override
public int getIllegalTypeErrorMessageId() {
return CDIValidationErrorManager.ILLEGAL_ALTERNATIVE_BEAN_CLASS_ID;
}
+ @Override
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE;
}
@@ -518,6 +527,7 @@
private class AlternativeStereotypeValidator extends AbstractTypeValidator {
+ @Override
public boolean validateSourceType(CDICoreValidator.CDIValidationContext context, IType type) {
IStereotype stereotype = context.getCdiProject().getStereotype(type);
return stereotype!=null && stereotype.isAlternative();
@@ -533,30 +543,37 @@
return "stereotype"; //$NON-NLS-1$
}
+ @Override
public String getParrentElementname() {
return "alternatives"; //$NON-NLS-1$
}
+ @Override
public String getEmptyTypeErrorMessage() {
return CDIValidationMessages.EMPTY_ALTERNATIVE_ANNOTATION_NAME;
}
+ @Override
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME;
}
+ @Override
public int getUnknownTypeErrorMessageId() {
return CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME_ID;
}
+ @Override
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION;
}
+ @Override
public int getIllegalTypeErrorMessageId() {
return CDIValidationErrorManager.ILLEGAL_ALTERNATIVE_ANNOTATION_ID;
}
+ @Override
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE;
}
@@ -569,35 +586,43 @@
private class DecoratorTypeValidator extends AbstractTypeValidator {
+ @Override
public boolean validateSourceType(CDICoreValidator.CDIValidationContext context, IType type) {
IClassBean classBean = context.getCdiProject().getBeanClass(type);
return classBean instanceof IDecorator;
}
+ @Override
public String getParrentElementname() {
return "decorators"; //$NON-NLS-1$
}
+ @Override
public String getEmptyTypeErrorMessage() {
return CDIValidationMessages.EMPTY_DECORATOR_BEAN_CLASS_NAME;
}
-
+
+ @Override
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME;
}
-
+
+ @Override
public int getUnknownTypeErrorMessageId() {
return CDIValidationErrorManager.UNKNOWN_DECORATOR_BEAN_CLASS_NAME_ID;
}
+ @Override
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS;
}
+ @Override
public int getIllegalTypeErrorMessageId() {
return CDIValidationErrorManager.ILLEGAL_DECORATOR_BEAN_CLASS_ID;
}
+ @Override
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_DECORATOR_CLASS;
}
@@ -610,35 +635,43 @@
private class InterceptorTypeValidator extends AbstractTypeValidator {
+ @Override
public boolean validateSourceType(CDICoreValidator.CDIValidationContext context, IType type) {
IClassBean classBean = context.getCdiProject().getBeanClass(type);
return classBean instanceof IInterceptor;
}
+ @Override
public String getParrentElementname() {
return "interceptors"; //$NON-NLS-1$
}
+ @Override
public String getEmptyTypeErrorMessage() {
return CDIValidationMessages.EMPTY_INTERCEPTOR_CLASS_NAME;
}
-
+
+ @Override
public String getUnknownTypeErrorMessage() {
return CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME;
}
-
+
+ @Override
public int getUnknownTypeErrorMessageId() {
return CDIValidationErrorManager.UNKNOWN_INTERCEPTOR_CLASS_NAME_ID;
}
+ @Override
public String getIllegalTypeErrorMessage() {
return CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS;
}
+ @Override
public int getIllegalTypeErrorMessageId() {
return CDIValidationErrorManager.ILLEGAL_INTERCEPTOR_CLASS_ID;
}
+ @Override
public String getDuplicateTypeErrorMessage() {
return CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS;
}
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java 2012-08-08 00:18:53 UTC (rev 42898)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java 2012-08-08 00:55:06 UTC (rev 42899)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.common.util;
-import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -31,7 +30,8 @@
private static class SafeRunnableForActivePage extends SafeRunnable {
- public ITextEditor activeEditor;
+ public ITextEditor activeTextEditor;
+ public IEditorPart activeEditor;
/*
* (non-Javadoc)
@@ -44,14 +44,14 @@
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
- IEditorPart editor = page.getActiveEditor();
- if (editor instanceof IEditorWrapper) {
- editor = ((IEditorWrapper) editor).getEditor();
+ activeEditor = page.getActiveEditor();
+ if (activeEditor instanceof IEditorWrapper) {
+ activeEditor = ((IEditorWrapper) activeEditor).getEditor();
}
- if (editor instanceof ITextEditor) {
- activeEditor = (ITextEditor) editor;
+ if (activeEditor instanceof ITextEditor) {
+ activeTextEditor = (ITextEditor) activeEditor;
} else {
- activeEditor = editor == null ? null : (ITextEditor)editor.getAdapter(ITextEditor.class);
+ activeTextEditor = activeEditor == null ? null : (ITextEditor)activeEditor.getAdapter(ITextEditor.class);
}
}
}
@@ -66,6 +66,16 @@
}
}
+ public static boolean isActiveEditorDirty() {
+ SafeRunnableForActivePage sr = new SafeRunnableForActivePage();
+ SafeRunnable.run(sr);
+ IEditorPart editor = sr.activeEditor;
+ if(editor!=null) {
+ return editor.isDirty();
+ }
+ return false;
+ }
+
/**
* Returns the active text editor.
* @return
@@ -73,7 +83,7 @@
public static ITextEditor getActiveEditor() {
SafeRunnableForActivePage sr = new SafeRunnableForActivePage();
SafeRunnable.run(sr);
- return sr.activeEditor;
+ return sr.activeTextEditor;
}
/**
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java 2012-08-08 00:18:53 UTC (rev 42898)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/multipage/DefaultMultipageEditor.java 2012-08-08 00:55:06 UTC (rev 42899)
@@ -36,10 +36,11 @@
}
public boolean isDirty() {
- XModelObject o = getModelObject();
- if((o != null && o.isModified()) ||
- (textEditor != null && textEditor.isModified())) return true;
- return false;
+ return super.isDirty();
+// XModelObject o = getModelObject();
+// if((o != null && o.isModified()) ||
+// (textEditor != null && textEditor.isModified())) return true;
+// return false;
}
protected void setNormalMode() {
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-08 00:18:53 UTC (rev 42898)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-08 00:55:06 UTC (rev 42899)
@@ -86,35 +86,37 @@
static void removeMessages() {
UIJob job = new UIJob("Removing as-you-type JBT validation problems") {
public IStatus runInUIThread(IProgressMonitor monitor) {
- ITextEditor e = EclipseUIUtil.getActiveEditor();
- if(e!=null && !e.isDirty()) {
- IEditorInput input = e.getEditorInput();
- IDocumentProvider dp = e.getDocumentProvider();
- IDocument doc = dp.getDocument(input);
- boolean ok = false;
- synchronized (reporters) {
- ok = reporters.contains(doc);
- }
- if(ok) {
- IAnnotationModel model = dp.getAnnotationModel(input);
- if(model instanceof AbstractMarkerAnnotationModel) {
- AbstractMarkerAnnotationModel anModel = ((AbstractMarkerAnnotationModel)model);
- synchronized (anModel.getLockObject()) {
- Iterator iterator = anModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- Object o = iterator.next();
- if(o instanceof TemporaryAnnotation) {
- TemporaryAnnotation annotation = (TemporaryAnnotation)o;
- Map attributes = annotation.getAttributes();
- if(attributes!=null && attributes.get(TempMarkerManager.AS_YOU_TYPE_VALIDATION_ANNOTATION_ATTRIBUTE)!=null) {
+ if(!EclipseUIUtil.isActiveEditorDirty()) {
+ ITextEditor e = EclipseUIUtil.getActiveEditor();
+ if(e!=null) {
+ IEditorInput input = e.getEditorInput();
+ IDocumentProvider dp = e.getDocumentProvider();
+ IDocument doc = dp.getDocument(input);
+ boolean ok = false;
+ synchronized (reporters) {
+ ok = reporters.contains(doc);
+ }
+ if(ok) {
+ IAnnotationModel model = dp.getAnnotationModel(input);
+ if(model instanceof AbstractMarkerAnnotationModel) {
+ AbstractMarkerAnnotationModel anModel = ((AbstractMarkerAnnotationModel)model);
+ synchronized (anModel.getLockObject()) {
+ Iterator iterator = anModel.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Object o = iterator.next();
+ if(o instanceof TemporaryAnnotation) {
+ TemporaryAnnotation annotation = (TemporaryAnnotation)o;
+ Map attributes = annotation.getAttributes();
+ if(attributes!=null && attributes.get(TempMarkerManager.AS_YOU_TYPE_VALIDATION_ANNOTATION_ATTRIBUTE)!=null) {
+ anModel.removeAnnotation(annotation);
+ }
+ } else if(o instanceof DisabledAnnotation) {
+ DisabledAnnotation annotation = (DisabledAnnotation)o;
anModel.removeAnnotation(annotation);
+ } else if(o instanceof TempJavaProblemAnnotation) {
+ TempJavaProblemAnnotation annotation = (TempJavaProblemAnnotation)o;
+ anModel.removeAnnotation(annotation);
}
- } else if(o instanceof DisabledAnnotation) {
- DisabledAnnotation annotation = (DisabledAnnotation)o;
- anModel.removeAnnotation(annotation);
- } else if(o instanceof TempJavaProblemAnnotation) {
- TempJavaProblemAnnotation annotation = (TempJavaProblemAnnotation)o;
- anModel.removeAnnotation(annotation);
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java 2012-08-08 00:18:53 UTC (rev 42898)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/TempMarkerManager.java 2012-08-08 00:55:06 UTC (rev 42899)
@@ -212,8 +212,8 @@
protected void disableProblemAnnotations(final ITextSourceReference reference) {
UIJob job = new UIJob("As-you-type JBT validation. Disabling the marker annotations.") {
public IStatus runInUIThread(IProgressMonitor monitor) {
- ITextEditor e = EclipseUIUtil.getActiveEditor();
- if(e!=null && e.isDirty()) {
+ if(EclipseUIUtil.isActiveEditorDirty()) {
+ ITextEditor e = EclipseUIUtil.getActiveEditor();
IEditorInput input = e.getEditorInput();
IDocumentProvider dp = e.getDocumentProvider();
if(document == dp.getDocument(input)) {
12 years, 5 months