Author: mareshkau
Date: 2009-03-02 14:01:43 -0500 (Mon, 02 Mar 2009)
New Revision: 13922
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3869
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java 2009-03-02
18:11:27 UTC (rev 13921)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java 2009-03-02
19:01:43 UTC (rev 13922)
@@ -41,8 +41,7 @@
}
}
return false;
- }
- if (element instanceof IProject && ((IProject) element).isOpen())
+ } if (element instanceof IProject && ((IProject) element).isOpen())
return true;
if (element instanceof IContainer) { // i.e. IProject, IFolder
try {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java 2009-03-02
18:11:27 UTC (rev 13921)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java 2009-03-02
19:01:43 UTC (rev 13922)
@@ -14,6 +14,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
@@ -28,7 +30,9 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.FileExtensionFilter;
@@ -100,6 +104,20 @@
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setAllowMultiple(false);
dialog.setDoubleClickSelects(true);
+ dialog.setValidator(new ISelectionStatusValidator(){
+
+ public IStatus validate(Object[] selection) {
+ if(selection!=null && selection.length==1) {
+ if(selection[0] instanceof IFile) {
+ return new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
+ IStatus.OK, "", //$NON-NLS-1$
+ null);
+ }
+ }
+ return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
+ IStatus.ERROR, WebUIMessages.WIZARD_ERROR_FILE_SELECTION,
//$NON-NLS-1$
+ null);
+ }});
if (currentFile != null) {
dialog.setInitialSelection(currentFile);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java 2009-03-02
18:11:27 UTC (rev 13921)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java 2009-03-02
19:01:43 UTC (rev 13922)
@@ -13,6 +13,7 @@
public static String WIZARD_WINDOW_TITLE;
public static String WIZARD_TITLE;
public static String WIZARD_DESCRIPTION;
+ public static String WIZARD_ERROR_FILE_SELECTION;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, WebUIMessages.class);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties 2009-03-02
18:11:27 UTC (rev 13921)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties 2009-03-02
19:01:43 UTC (rev 13922)
@@ -7,4 +7,5 @@
WIZARD_WINDOW_TITLE=CSS Style Class Editor
WIZARD_TITLE=CSS Class
WIZARD_DESCRIPTION=Create New CSS Class
+WIZARD_ERROR_FILE_SELECTION=No file specified