Author: yzhishko
Date: 2010-04-07 09:39:19 -0400 (Wed, 07 Apr 2010)
New Revision: 21305
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/JSFNaturesInfoDialog.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/KBNaturesInfoDialog.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/AddJSFCapabilitiesWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/MarkerUtils.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixWizard.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.project
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/.jsdtscope
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.jdt.core.prefs
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.component
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/User.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/Messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/User.class
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-api.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-impl.jar
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/web.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/index.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/hello.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/inputUserName.jsp
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckTest/
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSFNaturesInfoDialog_JBIDE5701.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/KbNaturesInfoDialog_JBIDE6125.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NaturesInfoDialogTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/TestUtil.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/plugin.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6125 - fixed
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -12,17 +12,12 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.jsf.ui.editor.check.ProjectNaturesChecker;
-import org.jboss.tools.jsf.ui.editor.check.ProjectNaturesPartListener;
import org.osgi.framework.BundleContext;
public class JsfUiPlugin extends BaseUIPlugin {
-
- private ProjectNaturesPartListener partListener = new ProjectNaturesPartListener();
public static String PLUGIN_ID = "org.jboss.tools.jsf.ui"; //$NON-NLS-1$
@@ -31,8 +26,7 @@
public void start(BundleContext context) throws Exception {
super.start(context);
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- window.getPartService().addPartListener(partListener);
+ ProjectNaturesChecker.getInstance();
}
public static JsfUiPlugin getDefault() {
@@ -60,14 +54,6 @@
@Override
public void stop(BundleContext context) throws Exception {
- if (partListener != null) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- window.getPartService().removePartListener(partListener);
- partListener = null;
- }
- ProjectNaturesChecker naturesChecker = ProjectNaturesChecker.getInstance();
- naturesChecker.dispose();
- naturesChecker = null;
super.stop(context);
}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.ui.editor.check;
-
-import org.eclipse.core.resources.IProject;
-import org.jboss.tools.jsf.ui.action.AddJSFNatureActionDelegate;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class AddJSFCapabilitiesDelegate extends AddJSFNatureActionDelegate {
-
- private static AddJSFCapabilitiesDelegate instance = new AddJSFCapabilitiesDelegate();
-
- private AddJSFCapabilitiesDelegate() {
- }
-
- public static AddJSFCapabilitiesDelegate getInstance(IProject project) {
- instance.setProject(project);
- return instance;
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
-}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/JSFNaturesInfoDialog.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/JSFNaturesInfoDialog.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/JSFNaturesInfoDialog.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.jsf.ui.editor.check.wizards.AddJSFCapabilitiesWizard;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class JSFNaturesInfoDialog extends ProjectNaturesInfoDialog {
+
+ private static final String fixButtonLabel = "Add JSF Capabilities...";
//$NON-NLS-1$
+
+ public JSFNaturesInfoDialog(IProject project) {
+ super(project, fixButtonLabel);
+ }
+
+ @Override
+ protected void fixButtonPressed() {
+ BusyIndicator.showWhile(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell().getDisplay(),
+ new Runnable() {
+ public void run() {
+ AddJSFCapabilitiesWizard.getInstance(project).run(
+ null);
+ }
+ });
+ }
+
+ @Override
+ protected String getMessageInfo() {
+ String dialogMessage = "JBoss Tools Editor might not fully work in project
\"" + project.getName() + //$NON-NLS-1$
+ "\" because it does not have JSF and code completion enabled
completely.\n\n" //$NON-NLS-1$
+ + "Please use the Configure menu on the project or \"Add JSF
Capabilities...\" fix button to enable JSF if " //$NON-NLS-1$
+ + "you want all features of the editor working."; //$NON-NLS-1$
+ return dialogMessage;
+ }
+
+ @Override
+ protected void skipButtonPressed() {
+ try {
+ project.setPersistentProperty(
+ ProjectNaturesChecker.IS_JSF_NATURES_CHECK_NEED, Boolean
+ .toString(!isRemember));
+ } catch (CoreException e) {
+ }
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/KBNaturesInfoDialog.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/KBNaturesInfoDialog.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/KBNaturesInfoDialog.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jsf.ui.editor.check.wizards.QuickFixWizard;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class KBNaturesInfoDialog extends ProjectNaturesInfoDialog {
+
+ private static final String fixButtonLabel = "Enable JSF Code Completion...";
//$NON-NLS-1$
+
+ public KBNaturesInfoDialog(IProject project) {
+ super(project, fixButtonLabel);
+ }
+
+ @Override
+ protected void fixButtonPressed() {
+ try {
+ IMarker kbProblemMarker = null;
+ IMarker[] markers = project.findMarkers(null, false, 1);
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker = markers[i];
+ String _type = marker.getType();
+ if (_type != null
+ && _type.equals(KbProject.KB_PROBLEM_MARKER_TYPE)) {
+ kbProblemMarker = marker;
+ break;
+ }
+ }
+ if (kbProblemMarker != null) {
+ Map<IMarkerResolution, List<IMarker>> resolutions = new
LinkedHashMap<IMarkerResolution, List<IMarker>>(
+ 0);
+ List<IMarker> markerList = new ArrayList<IMarker>(0);
+ IMarkerResolution[] markerResolutions = IDE
+ .getMarkerHelpRegistry()
+ .getResolutions(kbProblemMarker);
+ markerList.add(kbProblemMarker);
+ resolutions.put(markerResolutions[0], markerList);
+ String markerDescription = kbProblemMarker.getAttribute(
+ IMarker.MESSAGE,
+ MarkerSupportInternalUtilities.EMPTY_STRING);
+ String description = NLS.bind(
+ MarkerMessages.MarkerResolutionDialog_Description,
+ markerDescription);
+ QuickFixWizard fixWizard = new QuickFixWizard(description,
+ resolutions);
+ fixWizard
+ .setWindowTitle(MarkerMessages.resolveMarkerAction_dialogTitle);
+ WizardDialog dialog = new QuickFixWizardDialog(PlatformUI
+ .getWorkbench().getActiveWorkbenchWindow().getShell(),
+ fixWizard);
+ dialog.open();
+ }
+ } catch (CoreException e) {
+ JsfUiPlugin.getDefault().logError(e);
+ }
+
+ }
+
+ @Override
+ protected String getMessageInfo() {
+ String dialogMessage = "The project \"" + project.getName() +
//$NON-NLS-1$
+ "\" does not have JSF code completion and validation enabled
completely.\n\n" //$NON-NLS-1$
+ + "Please use \"Enabale JSF Code Completion...\" fix button if "
//$NON-NLS-1$
+ + "you want these features working."; //$NON-NLS-1$
+ return dialogMessage;
+ }
+
+ private class QuickFixWizardDialog extends WizardDialog {
+
+ /**
+ * @param parentShell
+ * @param newWizard
+ */
+ public QuickFixWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
+ | SWT.MODELESS | SWT.RESIZE | getDefaultOrientation());
+ }
+
+ }
+
+ @Override
+ protected void skipButtonPressed() {
+ try {
+ project.setPersistentProperty(
+ ProjectNaturesChecker.IS_KB_NATURES_CHECK_NEED, Boolean
+ .toString(!isRemember));
+ } catch (CoreException e) {
+ }
+ }
+
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -10,9 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.editor.check;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -23,7 +21,11 @@
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.util.FileUtil;
@@ -39,29 +41,40 @@
public class ProjectNaturesChecker implements IResourceChangeListener {
+ private ProjectNaturesPartListener partListener = new ProjectNaturesPartListener();
private static final String SEARCH_CLASS = "javax.faces.webapp.FacesServlet";
//$NON-NLS-1$
- public static final QualifiedName IS_NATURES_CHECK_NEED = new QualifiedName(
- "", "Is natures check"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final QualifiedName IS_JSF_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is JSF natures check"); //$NON-NLS-1$ //$NON-NLS-2$
+ public static final QualifiedName IS_KB_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is KB natures check"); //$NON-NLS-1$ //$NON-NLS-2$
public static final QualifiedName IS_JSF_CHECK_NEED = new QualifiedName(
"", "Is JSF check"); //$NON-NLS-1$ //$NON-NLS-2$
private Set<IProject> projectsCollection;
- private static final String JSF_NATURE = "JavaServer Faces Nature";
//$NON-NLS-1$
- private static final String KB_NATURE = "Knowledge Base Nature";
//$NON-NLS-1$
private static final String STRUTS_NATURE_ID =
"org.jboss.tools.struts.strutsnature"; //$NON-NLS-1$
-
+
private static ProjectNaturesChecker checker;
-
- public static ProjectNaturesChecker getInstance(){
+
+ public static ProjectNaturesChecker getInstance() {
if (checker == null) {
checker = new ProjectNaturesChecker();
}
return checker;
}
-
+
private ProjectNaturesChecker() {
projectsCollection = new HashSet<IProject>(0);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
IResourceChangeEvent.POST_CHANGE);
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ window.getPartService().addPartListener(partListener);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
+ .addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
}
public void resourceChanged(final IResourceChangeEvent event) {
@@ -81,40 +94,45 @@
}
addProject(project);
boolean isJSFCheck = true;
- boolean isNaturesCheck = true;
+ boolean isJSFNaturesCheck = true;
+ boolean isKBNaturesCheck = true;
updateProjectPersistentProperties(project);
isJSFCheck = Boolean.parseBoolean(project
.getPersistentProperty(IS_JSF_CHECK_NEED));
- isNaturesCheck = Boolean.parseBoolean(project
- .getPersistentProperty(IS_NATURES_CHECK_NEED));
+ isJSFNaturesCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_JSF_NATURES_CHECK_NEED));
+ isKBNaturesCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_KB_NATURES_CHECK_NEED));
if (isJSFCheck) {
- if (isNaturesCheck) {
- String[] missingNatures = getMissingNatures(project);
- if (missingNatures != null) {
- KbProject.checkKBBuilderInstalled(project);
- ProjectNaturesInfoDialog dialog = new ProjectNaturesInfoDialog(
- missingNatures, project);
+ String missingNature = checkMissingNatures(project);
+ if (missingNature != null) {
+ KbProject.checkKBBuilderInstalled(project);
+ ProjectNaturesInfoDialog dialog = null;
+ if (KbProject.NATURE_ID.equals(missingNature)
+ && isKBNaturesCheck) {
+ dialog = new KBNaturesInfoDialog(project);
+ } else if (WebProject.JSF_NATURE_ID.equals(missingNature)
+ && isJSFNaturesCheck) {
+ dialog = new JSFNaturesInfoDialog(project);
+ }
+ if (dialog != null) {
dialog.open();
}
}
}
}
- private String[] getMissingNatures(IProject project) throws CoreException {
- List<String> missingNatures = new ArrayList<String>(0);
+ private String checkMissingNatures(IProject project) throws CoreException {
if (project.getNature(STRUTS_NATURE_ID) != null) {
return null;
}
- if (project.getNature(IKbProject.NATURE_ID) == null) {
- missingNatures.add(JSF_NATURE);
- }
if (project.getNature(WebProject.JSF_NATURE_ID) == null) {
- missingNatures.add(KB_NATURE);
+ return WebProject.JSF_NATURE_ID;
}
- if (missingNatures.size() == 0) {
- return null;
+ if (project.getNature(IKbProject.NATURE_ID) == null) {
+ return IKbProject.NATURE_ID;
}
- return missingNatures.toArray(new String[0]);
+ return null;
}
private void handleResourceChangeEvent(IResourceChangeEvent changeEvent) {
@@ -138,7 +156,8 @@
try {
updateProjectJSFPersistents(project);
} catch (CoreException e) {
- ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, e);
+ ProblemReportingHelper.reportProblem(
+ JspEditorPlugin.PLUGIN_ID, e);
}
}
}
@@ -152,9 +171,14 @@
if (jsfCheckString == null) {
updateProjectJSFPersistents(project);
}
- if (project.getPersistentProperty(IS_NATURES_CHECK_NEED) == null) {
- project.setPersistentProperty(IS_NATURES_CHECK_NEED, "true");
//$NON-NLS-1$
+ if (project.getPersistentProperty(IS_JSF_NATURES_CHECK_NEED) == null) {
+ project
+ .setPersistentProperty(IS_JSF_NATURES_CHECK_NEED,
+ "true"); //$NON-NLS-1$
}
+ if (project.getPersistentProperty(IS_KB_NATURES_CHECK_NEED) == null) {
+ project.setPersistentProperty(IS_KB_NATURES_CHECK_NEED, "true");
//$NON-NLS-1$
+ }
}
}
@@ -169,6 +193,12 @@
}
public void dispose() {
+ if (partListener != null) {
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ window.getPartService().removePartListener(partListener);
+ partListener = null;
+ }
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
projectsCollection.clear();
}
@@ -179,7 +209,7 @@
updateProjectJSFPersistents(project);
} catch (CoreException e) {
ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, e);
- }
+ }
}
private void processRemoveProject(IProject project) {
@@ -202,5 +232,5 @@
}
}
}
-
+
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -13,8 +13,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
@@ -39,21 +37,21 @@
*
*/
-public class ProjectNaturesInfoDialog extends MessageDialog {
+public abstract class ProjectNaturesInfoDialog extends MessageDialog {
private Button button;
private Link link;
- private boolean isRemember = false;
+ protected boolean isRemember = false;
private static final String QUESTION = "Do not show this dialog again!";
//$NON-NLS-1$
private static final String TITLE = "Missing Natures"; //$NON-NLS-1$
- private IProject project;
+ protected IProject project;
- public ProjectNaturesInfoDialog(String[] missingNatures, IProject project) {
+ protected ProjectNaturesInfoDialog(IProject project, String fixButtonLabel) {
super(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
TITLE, null, "", INFORMATION, //$NON-NLS-1$
- new String[] {"Add JSF Capabilities...", IDialogConstants.OK_LABEL }, 0);
//$NON-NLS-1$
+ new String[] { fixButtonLabel, "Skip" }, 0); //$NON-NLS-1$
this.project = project;
- message = getMessageInfo(missingNatures, project);
+ message = getMessageInfo();
}
@Override
@@ -99,22 +97,13 @@
@Override
protected void buttonPressed(int buttonId) {
+ super.buttonPressed(buttonId);
if (buttonId == 0) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- AddJSFCapabilitiesDelegate.getInstance(project).run(null);
- }
- });
+ fixButtonPressed();
}
if (buttonId == 1) {
- try {
- project.setPersistentProperty(
- ProjectNaturesChecker.IS_NATURES_CHECK_NEED, Boolean
- .toString(!isRemember));
- } catch (CoreException e) {
- }
+ skipButtonPressed();
}
- super.buttonPressed(buttonId);
}
private void processLink(Link link) {
@@ -138,22 +127,11 @@
}
});
}
+
+ protected abstract String getMessageInfo();
- @SuppressWarnings("unused")
- private String arrayToString(String[] strings) {
- StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
- for (int i = 0; i < strings.length; i++) {
- builder.append(strings[i] + "\n"); //$NON-NLS-1$
- }
- return builder.toString();
- }
+ protected abstract void fixButtonPressed();
+
+ protected abstract void skipButtonPressed();
- private String getMessageInfo(String[] missingNatures, IProject project) {
- String dialogMessage = "JBoss Tools Visual Editor might not fully work in project
\"" + project.getName() + //$NON-NLS-1$
- "\" because it does not have JSF and code completion enabled
completely.\n\n" //$NON-NLS-1$
- + "Please use the Configure menu on the project to enable JSF if "
//$NON-NLS-1$
- + "you want all features of the editor working."; //$NON-NLS-1$
- return dialogMessage;
- }
-
}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/AddJSFCapabilitiesWizard.java
(from rev 21297,
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/AddJSFCapabilitiesWizard.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/AddJSFCapabilitiesWizard.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check.wizards;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jsf.ui.action.AddJSFNatureActionDelegate;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class AddJSFCapabilitiesWizard extends AddJSFNatureActionDelegate {
+
+ private static AddJSFCapabilitiesWizard instance = new AddJSFCapabilitiesWizard();
+
+ private AddJSFCapabilitiesWizard() {
+ }
+
+ public static AddJSFCapabilitiesWizard getInstance(IProject project) {
+ instance.setProject(project);
+ return instance;
+ }
+
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/MarkerUtils.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/MarkerUtils.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/MarkerUtils.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check.wizards;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class MarkerUtils {
+
+ static final IMarker[] EMPTY_MARKER_ARRAY = new IMarker[0];
+
+ /**
+ * Return a StatusAdapter for the error
+ *
+ * @param exception
+ * @return StatusAdapter
+ */
+ static final StatusAdapter errorFor(Throwable exception) {
+ IStatus status = new Status(IStatus.ERROR,
+ IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.ERROR, exception
+ .getLocalizedMessage(), exception);
+ return new StatusAdapter(status);
+ }
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixPage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixPage.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixPage.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,654 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.Map;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
+import org.eclipse.ui.internal.views.markers.ExtendedMarkersView;
+import org.eclipse.ui.internal.views.markers.MarkerSupportInternalUtilities;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.views.markers.WorkbenchMarkerResolution;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+import org.eclipse.ui.views.markers.internal.Util;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class QuickFixPage extends WizardPage {
+
+ private Map resolutions;
+ private ListViewer resolutionsList;
+ private CheckboxTableViewer markersTable;
+ /**
+ * Create a new instance of the receiver.
+ *
+ * @param problemDescription
+ * the description of the problem being fixed
+ * @param resolutions
+ * {@link Map} with key of {@link IMarkerResolution} and value of
+ * {@link Collection} of {@link IMarker}
+ */
+ public QuickFixPage(String problemDescription, Map resolutions) {
+ super(problemDescription);
+ this.resolutions = resolutions;
+ setTitle(MarkerMessages.resolveMarkerAction_dialogTitle);
+ setMessage(problemDescription);
+ }
+
+ public void createControl(Composite parent) {
+
+ initializeDialogUnits(parent);
+
+ // Create a new composite as there is the title bar seperator
+ // to deal with
+ Composite control = new Composite(parent, SWT.NONE);
+ control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ setControl(control);
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(control,
+ IWorkbenchHelpContextIds.PROBLEMS_VIEW);
+
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.spacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ control.setLayout(layout);
+
+ Label resolutionsLabel = new Label(control, SWT.NONE);
+ resolutionsLabel
+ .setText(MarkerMessages.MarkerResolutionDialog_Resolutions_List_Title);
+
+ resolutionsLabel.setLayoutData(new FormData());
+
+ createResolutionsList(control);
+
+ FormData listData = new FormData();
+ listData.top = new FormAttachment(resolutionsLabel, 0);
+ listData.left = new FormAttachment(0);
+ listData.right = new FormAttachment(100, 0);
+ listData.height = convertHeightInCharsToPixels(10);
+ resolutionsList.getControl().setLayoutData(listData);
+
+ Label title = new Label(control, SWT.NONE);
+ title
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Title);
+ FormData labelData = new FormData();
+ labelData.top = new FormAttachment(resolutionsList.getControl(), 0);
+ labelData.left = new FormAttachment(0);
+ title.setLayoutData(labelData);
+
+ createMarkerTable(control);
+
+ Composite buttons = createTableButtons(control);
+ FormData buttonData = new FormData();
+ buttonData.top = new FormAttachment(title, 0);
+ buttonData.right = new FormAttachment(100);
+ buttonData.height = convertHeightInCharsToPixels(10);
+ buttons.setLayoutData(buttonData);
+
+ FormData tableData = new FormData();
+ tableData.top = new FormAttachment(buttons, 0, SWT.TOP);
+ tableData.left = new FormAttachment(0);
+ tableData.bottom = new FormAttachment(100);
+ tableData.right = new FormAttachment(buttons, 0);
+ tableData.height = convertHeightInCharsToPixels(10);
+ markersTable.getControl().setLayoutData(tableData);
+
+ Dialog.applyDialogFont(control);
+
+ resolutionsList.setSelection(new StructuredSelection(resolutionsList
+ .getElementAt(0)));
+
+ markersTable.setAllChecked(true);
+ }
+
+ /**
+ * Create the table buttons for the receiver.
+ *
+ * @param control
+ * @return {@link Composite}
+ */
+ private Composite createTableButtons(Composite control) {
+
+ Composite buttonComposite = new Composite(control, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ layout.verticalSpacing =
convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ buttonComposite.setLayout(layout);
+
+ Button selectAll = new Button(buttonComposite, SWT.PUSH);
+ selectAll.setText(MarkerMessages.selectAllAction_title);
+ selectAll.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
+
+ selectAll.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ markersTable.setAllChecked(true);
+ setPageComplete(!resolutionsList.getSelection().isEmpty());
+ }
+ });
+
+ Button deselectAll = new Button(buttonComposite, SWT.PUSH);
+ deselectAll.setText(MarkerMessages.filtersDialog_deselectAll);
+ deselectAll
+ .setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
+
+ deselectAll.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ markersTable.setAllChecked(false);
+ setPageComplete(false);
+ }
+ });
+
+ return buttonComposite;
+ }
+
+ /**
+ * @param control
+ */
+ private void createResolutionsList(Composite control) {
+ resolutionsList = new ListViewer(control, SWT.BORDER | SWT.SINGLE
+ | SWT.V_SCROLL);
+ resolutionsList.setContentProvider(new IStructuredContentProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IStructuredContentProvider#getElements
+ * (java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return resolutions.keySet().toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
+ * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+ });
+
+ resolutionsList.setLabelProvider(new LabelProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return ((IMarkerResolution) element).getLabel();
+ }
+ });
+
+ resolutionsList.setInput(this);
+
+ resolutionsList.setComparator(new ViewerComparator() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse
+ * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return ((IMarkerResolution) e1).getLabel().compareTo(
+ ((IMarkerResolution) e1).getLabel());
+ }
+ });
+
+ resolutionsList
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.jface.viewers.ISelectionChangedListener#
+ * selectionChanged
+ * (org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ markersTable.refresh();
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ if (window == null)
+ return;
+ IWorkbenchPage page = window.getActivePage();
+ if (page == null)
+ return;
+
+ }
+
+ });
+ }
+
+ /**
+ * Create the table that shows the markers.
+ *
+ * @param control
+ */
+ private void createMarkerTable(Composite control) {
+ markersTable = CheckboxTableViewer.newCheckList(control, SWT.BORDER
+ | SWT.V_SCROLL | SWT.SINGLE);
+
+ createTableColumns();
+
+ markersTable.setContentProvider(new IStructuredContentProvider() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IStructuredContentProvider#getElements
+ * (java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ IMarkerResolution selected = getSelectedResolution();
+ if (selected == null) {
+ return new Object[0];
+ }
+
+ if (resolutions.containsKey(selected)) {
+ return ((Collection) resolutions.get(selected)).toArray();
+ }
+ return MarkerUtils.EMPTY_MARKER_ARRAY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
+ * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+ });
+
+ markersTable.setLabelProvider(new ITableLabelProvider() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(
+ * java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0)
+ return Util.getImage(((IMarker) element).getAttribute(
+ IMarker.SEVERITY, -1));
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java
+ * .lang.Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ IMarker marker = (IMarker) element;
+ if (columnIndex == 0)
+ return Util.getResourceName(marker);
+
+ // Is the location override set?
+ String locationString = marker.getAttribute(IMarker.LOCATION,
+ MarkerSupportInternalUtilities.EMPTY_STRING);
+ if (locationString.length() > 0) {
+ return locationString;
+ }
+
+ // No override so use line number
+ int lineNumber = marker.getAttribute(IMarker.LINE_NUMBER, -1);
+ String lineNumberString = null;
+ if (lineNumber < 0)
+ lineNumberString = MarkerMessages.Unknown;
+ else
+ lineNumberString = NLS.bind(
+ MarkerMessages.label_lineNumber, Integer
+ .toString(lineNumber));
+
+ return lineNumberString;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.
+ * eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void addListener(ILabelProviderListener listener) {
+ // do nothing
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
+ public void dispose() {
+ // do nothing
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(
+ * java.lang.Object, java.lang.String)
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org
+ * .eclipse.jface.viewers.ILabelProviderListener)
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ // do nothing
+
+ }
+ });
+
+ markersTable.addCheckStateListener(new ICheckStateListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged
+ * (org.eclipse.jface.viewers.CheckStateChangedEvent)
+ */
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked() == true) {
+ setPageComplete(true);
+ } else {
+ setPageComplete(markersTable.getCheckedElements().length > 0);
+ }
+
+ }
+ });
+
+ markersTable
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.jface.viewers.ISelectionChangedListener#
+ * selectionChanged
+ * (org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+
+ if (event.getSelection().isEmpty())
+ return;
+ IMarker marker = (IMarker) ((IStructuredSelection) event
+ .getSelection()).getFirstElement();
+ ExtendedMarkersView.openMarkerInEditor(marker,
+ PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getActivePage());
+
+ }
+ });
+
+ markersTable.setInput(this);
+ }
+
+ /**
+ * Create the table columns for the receiver.
+ */
+ private void createTableColumns() {
+ TableLayout layout = new TableLayout();
+
+ Table table = markersTable.getTable();
+ table.setLayout(layout);
+ table.setLinesVisible(true);
+ table.setHeaderVisible(true);
+
+ layout.addColumnData(new ColumnWeightData(70, true));
+ TableColumn tc = new TableColumn(table, SWT.NONE, 0);
+ tc
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Location);
+ layout.addColumnData(new ColumnWeightData(30, true));
+ tc = new TableColumn(table, SWT.NONE, 0);
+ tc
+ .setText(MarkerMessages.MarkerResolutionDialog_Problems_List_Resource);
+
+ }
+
+ /**
+ * Return the marker being edited.
+ *
+ * @return IMarker or <code>null</code>
+ */
+ public IMarker getSelectedMarker() {
+ ISelection selection = markersTable.getSelection();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ IStructuredSelection struct = (IStructuredSelection) selection;
+ if (struct.size() == 1)
+ return (IMarker) struct.getFirstElement();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ public boolean isPageComplete() {
+ return true;
+ }
+
+ /**
+ * Finish has been pressed. Process the resolutions. monitor the monitor to
+ * report to.
+ */
+ /**
+ * @param monitor
+ */
+ /**
+ * @param monitor
+ */
+ void performFinish(IProgressMonitor monitor) {
+
+ final IMarkerResolution resolution = getSelectedResolution();
+ if (resolution == null)
+ return;
+
+ final Object[] checked = markersTable.getCheckedElements();
+ if (checked.length == 0)
+ return;
+
+ if (resolution instanceof WorkbenchMarkerResolution) {
+
+ try {
+ getWizard().getContainer().run(false, true,
+ new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.operation.IRunnableWithProgress
+ * #run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) {
+ IMarker[] markers = new IMarker[checked.length];
+ System.arraycopy(checked, 0, markers, 0,
+ checked.length);
+ ((WorkbenchMarkerResolution) resolution).run(
+ markers, monitor);
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(MarkerUtils.errorFor(e));
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(MarkerUtils.errorFor(e));
+ }
+
+ } else {
+
+ try {
+ getWizard().getContainer().run(false, true,
+ new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.operation.IRunnableWithProgress
+ * #run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) {
+ monitor
+ .beginTask(
+ MarkerMessages.MarkerResolutionDialog_Fixing,
+ checked.length);
+ for (int i = 0; i < checked.length; i++) {
+ // Allow paint events and wake up the button
+ getShell().getDisplay().readAndDispatch();
+ if (monitor.isCanceled())
+ return;
+ IMarker marker = (IMarker) checked[i];
+ monitor.subTask(Util.getProperty(
+ IMarker.MESSAGE, marker));
+ resolution.run(marker);
+ monitor.worked(1);
+ }
+ }
+
+ });
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(MarkerUtils.errorFor(e));
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(MarkerUtils.errorFor(e));
+ }
+
+ }
+
+ }
+
+ /**
+ * Return the marker resolution that is currently selected/
+ *
+ * @return IMarkerResolution or <code>null</code> if there is no selection.
+ */
+ private IMarkerResolution getSelectedResolution() {
+ ISelection selection = resolutionsList.getSelection();
+ if (!(selection instanceof IStructuredSelection)) {
+ return null;
+ }
+
+ Object first = ((IStructuredSelection) selection).getFirstElement();
+
+ return (IMarkerResolution) first;
+
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixWizard.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/wizards/QuickFixWizard.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.ui.editor.check.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IMarkerResolution;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages;
+import org.eclipse.ui.internal.ide.StatusUtil;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.views.markers.internal.MarkerMessages;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class QuickFixWizard extends Wizard {
+
+ private Map resolutionMap;
+ private String description;
+
+ /**
+ * Create the wizard with the map of resolutions.
+ *
+ * @param description
+ * the description of the problem
+ * @param resolutions
+ * Map key {@link IMarkerResolution} value {@link IMarker} []
+ * @param site
+ * the {@link IWorkbenchPartSite} to open the markers in
+ */
+ public QuickFixWizard(String description, Map resolutions) {
+ super();
+ this.resolutionMap = resolutions;
+ this.description = description;
+ setDefaultPageImageDescriptor(IDEInternalWorkbenchImages
+ .getImageDescriptor(IDEInternalWorkbenchImages.IMG_DLGBAN_QUICKFIX_DLG));
+ setNeedsProgressMonitor(true);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages() {
+ super.addPages();
+ addPage(new QuickFixPage(description, resolutionMap));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ public boolean performFinish() {
+ IRunnableWithProgress finishRunnable = new IRunnableWithProgress() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse
+ * .core.runtime.IProgressMonitor)
+ */
+ public void run(IProgressMonitor monitor) {
+ IWizardPage[] pages = getPages();
+ monitor.beginTask(MarkerMessages.MarkerResolutionDialog_Fixing,
+ (10 * pages.length) + 1);
+ monitor.worked(1);
+ for (int i = 0; i < pages.length; i++) {
+ // Allow for cancel event processing
+ getShell().getDisplay().readAndDispatch();
+ if (monitor.isCanceled())
+ return;
+ QuickFixPage wizardPage = (QuickFixPage) pages[i];
+ wizardPage
+ .performFinish(new SubProgressMonitor(monitor, 10));
+ monitor.worked(1);
+ }
+ monitor.done();
+
+ }
+ };
+
+ try {
+ getContainer().run(false, true, finishRunnable);
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(
+ StatusUtil.newStatus(IStatus.ERROR,
+ e.getLocalizedMessage(), e));
+ return false;
+ } catch (InterruptedException e) {
+ StatusManager.getManager().handle(
+ StatusUtil.newStatus(IStatus.ERROR,
+ e.getLocalizedMessage(), e));
+ return false;
+ }
+
+ return true;
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.classpath
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.classpath
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.classpath 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="JavaSource"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache
Tomcat v6.0">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.web"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_16">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output"
path="WebContent/WEB-INF/classes"/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.project
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.project 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>naturesCheckKBTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ <nature>org.jboss.tools.jsf.jsfnature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/.jsdtscope
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/.jsdtscope
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/.jsdtscope 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.jdt.core.prefs 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,7 @@
+#Wed Apr 07 16:00:34 EEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.component
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.component 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+<wb-module deploy-name="naturesCheckKBTest">
+<wb-resource deploy-path="/" source-path="/WebContent"/>
+<wb-resource deploy-path="/WEB-INF/classes"
source-path="/JavaSource"/>
+<property name="context-root" value="naturesCheckKBTest"/>
+<property name="java-output-path"
value="/naturesCheckKBTest/WebContent/WEB-INF/classes"/>
+</wb-module>
+</project-modules>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.common.project.facet.core.xml 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="Apache Tomcat v6.0"/>
+ <fixed facet="jst.web"/>
+ <fixed facet="jst.java"/>
+ <installed facet="jst.java" version="5.0"/>
+ <installed facet="jst.web" version="2.5"/>
+</faceted-project>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.container
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.container 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.name
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/.settings/org.eclipse.wst.jsdt.ui.superType.name 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/Messages.properties
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/Messages.properties
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/Messages.properties 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/User.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/User.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/JavaSource/demo/User.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package demo;
+
+/**
+ * Created by JBoss Developer Studio
+ */
+public class User {
+
+ private String name;
+
+ /**
+ * @return User Name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param User Name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/META-INF/MANIFEST.MF
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/META-INF/MANIFEST.MF 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/Messages.properties
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/Messages.properties
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/Messages.properties 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,3 @@
+header=Hello Demo Application
+prompt_message=Name:
+hello_message=Hello
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/User.class
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/classes/demo/User.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/faces-config.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/faces-config.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/faces-config.xml 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <description>User Name Bean</description>
+ <managed-bean-name>user</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputUserName.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>hello</from-outcome>
+ <to-view-id>/pages/hello.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <locale-config/>
+ </application>
+ <factory/>
+ <lifecycle/>
+</faces-config>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-api.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-impl.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/lib/jsf-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/web.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/web.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/WEB-INF/web.xml 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <display-name>naturesCheckKBTest</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <!-- Faces Servlet Mapping -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/index.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/index.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/index.jsp 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,7 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+ <body>
+ <jsp:forward page="/pages/inputUserName.jsf" />
+ </body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/hello.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/hello.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/hello.jsp 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,20 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+<f:loadBundle var="Message" basename="demo.Messages" />
+
+<html>
+ <head>
+ <title>Hello!</title>
+ </head>
+
+ <body>
+ <f:view>
+ <h3>
+ <h:outputText value="#{Message.hello_message}" />,
+ <h:outputText value="#{user.name}" />!
+ </h3>
+ </f:view>
+ </body>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/inputUserName.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/inputUserName.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/WebContent/pages/inputUserName.jsp 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,28 @@
+<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f" %>
+<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h" %>
+
+<f:loadBundle var="Message" basename="demo.Messages"/>
+
+<html>
+ <head>
+ <title>Input User Name Page</title>
+ </head>
+ <body>
+
+ <f:view>
+ <h1><h:outputText value="#{Message.header}"/></h1>
+
+ <h:messages style="color: red"/>
+
+ <h:form id="greetingForm">
+ <h:outputText value="#{Message.prompt_message}"/>
+ <h:inputText value="#{user.name}" required="true">
+ <f:validateLength maximum="30" minimum="3"/>
+ </h:inputText>
+
+ <h:commandButton action="hello" value="Say Hello!" />
+
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.properties
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.properties
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.properties 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,3 @@
+#
+#Wed Apr 07 16:00:34 EEST 2010
+classpath.external=
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckKBTest/ant/build.xml 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,74 @@
+<project name="KickStart" default="deploy"
basedir="../">
+
+ <!-- Project settings -->
+ <property file="${basedir}/ant/build.properties" />
+
+ <property name="project.name" value="KickStart" />
+ <property name="web.content.dir" value="${basedir}/WebContent"
/>
+ <property name="web-inf.dir" value="${web.content.dir}/WEB-INF"
/>
+ <property name="build.dir" value="build" />
+ <property name="war.name"
value="${build.dir}/${project.name}.war" />
+
+ <!-- Define a folder for deployment -->
+ <property name="deploy.dir" value="deploy" />
+
+ <!-- Compile classpath -->
+ <path id="compile.classpath">
+ <fileset dir="${webinf.dir}/lib">
+ <include name="**/*.jar" />
+ </fileset>
+ <pathelement path="${classpath}" />
+ <pathelement path="${classpath.external}" />
+ <pathelement path="${webinf.dir}/classes" />
+ </path>
+
+ <!-- Copy any resource or configuration files -->
+ <target name="copyResources">
+ <copy todir="${web-inf.dir}/classes" includeEmptyDirs="no">
+ <fileset dir="JavaSource">
+ <patternset>
+ <include name="**/*.*" />
+ <exclude name="**/*.java" />
+ </patternset>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Check timestamp on files -->
+ <target name="prepare">
+ <tstamp />
+ </target>
+
+ <!-- Remove classes directory for clean build -->
+ <target name="clean" description="Prepare for clean build">
+ <delete dir="${web-inf.dir}/classes" failonerror="false"/>
+ <mkdir dir="${web-inf.dir}/classes" />
+ </target>
+
+ <!-- Normal build of application -->
+ <target name="compile" depends="prepare, copyResources">
+ <javac srcdir="JavaSource" destdir="${web-inf.dir}/classes">
+ <classpath refid="compile.classpath" />
+ </javac>
+ </target>
+
+ <!-- Build Project -->
+ <target name="build" depends="prepare, compile" />
+
+ <!-- Rebuild Project -->
+ <target name="rebuild" depends="clean, prepare, compile" />
+
+ <!-- Build WAR -->
+ <target name="war" depends="build">
+ <mkdir dir="${build.dir}" />
+ <war warfile="${war.name}" basedir="${web.content.dir}"
webxml="${web-inf.dir}/web.xml">
+ <exclude name="WEB-INF/web.xml" />
+ </war>
+ </target>
+
+ <target name="deploy" depends="war">
+ <delete dir="${deploy.dir}/${project.name}"
failonerror="false"/>
+ <copy file="${war.name}" todir="${deploy.dir}" />
+ </target>
+
+</project>
\ No newline at end of file
Copied: trunk/jsf/tests/org.jboss.tools.jsf.ui.test/projects/naturesCheckTest (from rev
21297, trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/naturesCheckTest)
Copied:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSFNaturesInfoDialog_JBIDE5701.java
(from rev 21297,
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java)
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSFNaturesInfoDialog_JBIDE5701.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSFNaturesInfoDialog_JBIDE5701.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.jsf.ui.test;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class JSFNaturesInfoDialog_JBIDE5701 extends NaturesInfoDialogTest {
+
+ private static final String testProjectName = "naturesCheckTest";
//$NON-NLS-1$
+ private static final String TEST_STRING = "JBoss Tools Editor might not fully work
in project \"" //$NON-NLS-1$
+ + testProjectName +
+ "\" because it does not have JSF and code completion enabled
completely.\n\n" + //$NON-NLS-1$
+ "Please use the Configure menu on the project or \"Add JSF
Capabilities...\" fix button to enable JSF if " + //$NON-NLS-1$
+ "you want all features of the editor working."; //$NON-NLS-1$
+
+ public JSFNaturesInfoDialog_JBIDE5701(String name) {
+ super(name);
+ }
+
+
+ public void testJSFNaturesChecker() throws Throwable {
+
+ ResultObject resultObject = startCheckerThread();
+
+ openPage(getTestProjectName(), TEST_PAGE_NAME);
+
+ if ("".equals(resultObject.getShellName()) &&
"".equals(resultObject.getTextLabel())) { //$NON-NLS-1$ //$NON-NLS-2$
+ throw new Exception("Project natures checker dialog hasn't appeared
:(("); //$NON-NLS-1$
+ }
+
+ assertEquals(TEST_SHELL_NAME, resultObject.getShellName());
+ assertEquals(getDialogMessage(), resultObject.getTextLabel());
+
+ }
+
+ @Override
+ protected String getDialogMessage() {
+ return TEST_STRING;
+ }
+
+ @Override
+ protected String getTestProjectName() {
+ return testProjectName;
+ }
+
+}
\ No newline at end of file
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -7,21 +7,19 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jsf.ui.test;
-import org.jboss.tools.jsf.ui.preferences.JSFCapabilitiesPreferencesPage;
import org.jboss.tools.jsf.ui.test.refactoring.ELReferencesRenameTest;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-
import junit.framework.Test;
import junit.framework.TestSuite;
public class JsfUiAllTests {
public static Test suite() {
- TestSuite suite = new TestSuite("JSF UI tests");
+ TestSuite suite = new TestSuite("JSF UI tests"); //$NON-NLS-1$
suite.addTestSuite(CssClassNewWizardTest.class);
suite.addTestSuite(CssFileNewWizardTest.class);
suite.addTestSuite(CSSStyleDialogTest.class);
@@ -33,11 +31,18 @@
suite.addTestSuite(PropertiesNewWizardTest.class);
suite.addTestSuite(XhtmlFileNewWizardTest.class);
suite.addTestSuite(JsfUiPreferencesPagesTest.class);
- suite.addTest(new ProjectImportTestSetup(new TestSuite(ELReferencesRenameTest.class),
- "org.jboss.tools.jsf.ui.test",
- new String[]{"projects/testJSFProject",},
- new String[]{"testJSFProject"}));
-
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(
+ ELReferencesRenameTest.class), "org.jboss.tools.jsf.ui.test",
//$NON-NLS-1$
+ new String[] { "projects/testJSFProject", }, //$NON-NLS-1$
+ new String[] { "testJSFProject" })); //$NON-NLS-1$
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(
+ JSFNaturesInfoDialog_JBIDE5701.class),
+ "org.jboss.tools.jsf.ui.test", "projects/naturesCheckTest",
//$NON-NLS-1$ //$NON-NLS-2$
+ "naturesCheckTest")); //$NON-NLS-1$
+ suite.addTest(new ProjectImportTestSetup(new TestSuite(
+ KbNaturesInfoDialog_JBIDE6125.class),
+ "org.jboss.tools.jsf.ui.test", "projects/naturesCheckKBTest",
//$NON-NLS-1$ //$NON-NLS-2$
+ "naturesCheckKBTest")); //$NON-NLS-1$
return new TestWizardsProject(suite);
}
}
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/KbNaturesInfoDialog_JBIDE6125.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/KbNaturesInfoDialog_JBIDE6125.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/KbNaturesInfoDialog_JBIDE6125.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.jsf.ui.test;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class KbNaturesInfoDialog_JBIDE6125 extends NaturesInfoDialogTest {
+
+ private static final String testProjectName = "naturesCheckKBTest";
//$NON-NLS-1$
+ private static final String TEST_STRING = "The project \"" //$NON-NLS-1$
+ + testProjectName
+ + "\" does not have JSF code completion and validation enabled
completely.\n\n" + //$NON-NLS-1$
+ "Please use \"Enabale JSF Code Completion...\" fix button if " +
//$NON-NLS-1$
+ "you want these features working."; //$NON-NLS-1$
+
+ public KbNaturesInfoDialog_JBIDE6125(String name) {
+ super(name);
+ }
+
+ public void testKBNaturesChecker() throws Throwable {
+
+ ResultObject resultObject = startCheckerThread();
+
+ openPage(getTestProjectName(), TEST_PAGE_NAME);
+
+ if ("".equals(resultObject.getShellName()) &&
"".equals(resultObject.getTextLabel())) { //$NON-NLS-1$ //$NON-NLS-2$
+ throw new Exception(
+ "Project natures checker dialog hasn't appeared :(("); //$NON-NLS-1$
+ }
+
+ assertEquals(TEST_SHELL_NAME, resultObject.getShellName());
+ assertEquals(getDialogMessage(), resultObject.getTextLabel());
+
+ }
+
+ @Override
+ protected String getDialogMessage() {
+ return TEST_STRING;
+ }
+
+ @Override
+ protected String getTestProjectName() {
+ return testProjectName;
+ }
+
+}
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NaturesInfoDialogTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NaturesInfoDialogTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NaturesInfoDialogTest.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * 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.jsf.ui.test;
+
+import junit.framework.TestCase;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditorPart;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public abstract class NaturesInfoDialogTest extends TestCase{
+
+ protected static final String TEST_PAGE_NAME = "inputUserName.jsp";
//$NON-NLS-1$
+ protected static final String TEST_SHELL_NAME = "Missing Natures";
//$NON-NLS-1$
+ private volatile boolean isCheckNeed = true;
+ private static IProject testProject;
+
+ protected NaturesInfoDialogTest(String name) {
+ super(name);
+ }
+
+ protected final class ResultObject {
+ private String shellName = ""; //$NON-NLS-1$
+ private String textLabel = ""; //$NON-NLS-1$
+
+ public String getShellName() {
+ return shellName;
+ }
+
+ public void setShellName(String shellName) {
+ this.shellName = shellName;
+ }
+
+ public String getTextLabel() {
+ return textLabel;
+ }
+
+ public void setTextLabel(String textLabel) {
+ this.textLabel = textLabel;
+ }
+
+ }
+
+ protected final ResultObject startCheckerThread() {
+ final Shell[] shell = new Shell[1];
+ final ResultObject resultObject = new ResultObject();
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ TestUtil.waitForIdle();
+ while (shell[0] == null && isCheckNeed) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell[] shells = Display.getCurrent().getShells();
+ shell[0] = findShellWithText(shells, TEST_SHELL_NAME);
+ if (shell[0] != null) {
+ resultObject.setShellName(TEST_SHELL_NAME);
+ Label label = (Label)shell[0].getChildren()[1];
+ resultObject.setTextLabel(label.getText());
+ shell[0].close();
+ }
+ }
+ });
+ }
+ }
+ });
+ thread.start();
+ return resultObject;
+ }
+
+ private static Shell findShellWithText (Shell[] shells, String text){
+ for (int i = 0; i < shells.length; i++) {
+ if (text.equals(shells[i].getText())) {
+ return shells[i];
+ }
+ }
+ return null;
+ }
+
+ protected final void openPage(String projectName, String pagePath) throws Throwable{
+ IFile file = (IFile)
testProject.getFolder("WebContent/pages").findMember(pagePath); //$NON-NLS-1$
+
+ assertNotNull("Could not open specified file. componentPage = "
//$NON-NLS-1$
+ + pagePath
+ + ";projectName = " + projectName, file);//$NON-NLS-1$
+
+ IEditorInput input = new FileEditorInput(file);
+
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
+ // open and get editor
+
+ JSPMultiPageEditorPart part = TestUtil.openEditor(input);
+
+ isCheckNeed = false;
+
+ assertNotNull("Editor is not opened", part); //$NON-NLS-1$
+
+ TestUtil.delay(3000);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.setProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER",
"true"); //$NON-NLS-1$ //$NON-NLS-2$
+
JspEditorPlugin.getDefault().getPreferenceStore().setValue(IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE,
true);
+ testProject = ProjectImportTestSetup.loadProject(getTestProjectName());
+ testProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE,
false);
+ System.setProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER",
"false"); //$NON-NLS-1$ //$NON-NLS-2$
+ super.tearDown();
+ }
+
+ protected abstract String getTestProjectName();
+
+ protected abstract String getDialogMessage();
+
+}
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/TestUtil.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/TestUtil.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/TestUtil.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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.jsf.ui.test;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditorPart;
+
+import static junit.framework.Assert.*;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class TestUtil {
+
+ /** Editor in which we open visual page. */
+ public final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
+
+ /** The Constant MAX_IDLE. */
+ public static final long MAX_IDLE = 15*1000L;
+
+ public static void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
+
+ public static void waitForIdle(long maxIdle) {
+ long start = System.currentTimeMillis();
+ while (!Job.getJobManager().isIdle()) {
+ delay(500);
+ if ( (System.currentTimeMillis()-start) > maxIdle )
+ throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
+ }
+ }
+
+ public static void waitForIdle() {
+ waitForIdle(MAX_IDLE);
+ }
+
+ public static JSPMultiPageEditorPart openEditor(IEditorInput input) throws
PartInitException {
+
+ // get editor
+ JSPMultiPageEditorPart part = (JSPMultiPageEditorPart)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
+ input, EDITOR_ID, true);
+
+ assertNotNull(part);
+ return part;
+
+ }
+
+}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/plugin.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/plugin.xml 2010-04-07 13:27:06 UTC
(rev 21304)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/plugin.xml 2010-04-07 13:39:19 UTC
(rev 21305)
@@ -22,9 +22,6 @@
name="i18nTest"
path="resources/i18nTest"/>
<testProject
- name="naturesCheckTest"
- path="resources/naturesCheckTest"/>
- <testProject
name="jsfLocales"
path="resources/jsfLocales"/>
<testProject
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -79,7 +79,6 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide2362Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.MessageResolutionInPreviewTabTest;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.MozDirtyTest_JBIDE5105;
-import org.jboss.tools.jsf.vpe.jsf.test.jbide.NaturesChecker_JBIDE5701;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.NullPointerWithStyleProperty_JBIDE5193;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnCssClassTest_JBIDE4775;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnInJarPackageFragment_JBIDE5682;
@@ -210,7 +209,6 @@
suite.addTestSuite(MessageResolutionInPreviewTabTest.class);
suite.addTestSuite(OpenOnTLDPackedInJar_JBIDE5693.class);
suite.addTestSuite(PreferencesForEditors_JBIDE5692.class);
- suite.addTestSuite(NaturesChecker_JBIDE5701.class);
suite.addTestSuite(FacetProcessingTest.class);
suite.addTestSuite(RefreshBundles_JBIDE5460.class);
suite.addTestSuite(ExceptionInVPEComments_JBIDE5143.class);
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java 2010-04-07
13:27:06 UTC (rev 21304)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/NaturesChecker_JBIDE5701.java 2010-04-07
13:39:19 UTC (rev 21305)
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * 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.jsf.vpe.jsf.test.jbide;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.ui.test.VpeTest;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class NaturesChecker_JBIDE5701 extends VpeTest {
-
- private static final String FIRST_TEST_PAGE_NAME = "inputUserName.jsp";
//$NON-NLS-1$
- private static final String TEST_SHELL_NAME = "Missing Natures";
//$NON-NLS-1$
- private static final String TEST_STRING = "JBoss Tools Visual Editor might not
fully work in project \"" //$NON-NLS-1$
- + JsfAllTests.IMPORT_NATURES_CHECKER_PROJECT +
- "\" because it does not have JSF and code completion enabled
completely.\n\n" + //$NON-NLS-1$
- "Please use the Configure menu on the project to enable JSF if " +
//$NON-NLS-1$
- "you want all features of the editor working."; //$NON-NLS-1$
- private static final String SECOND_TEST_PAGE_NAME =
"components/commandButton.jsp"; //$NON-NLS-1$
- private volatile boolean isCheckNeed = true;
-
-
- public NaturesChecker_JBIDE5701(String name) {
- super(name);
- }
-
- public void testNaturesChecker() throws Throwable {
-
- ResultObject resultObject = startCheckerThread();
-
- openPage(JsfAllTests.IMPORT_NATURES_CHECKER_PROJECT, FIRST_TEST_PAGE_NAME);
-
- if ("".equals(resultObject.getShellName()) &&
"".equals(resultObject.getTextLabel())) { //$NON-NLS-1$ //$NON-NLS-2$
- throw new Exception("Project natures checker dialog hasn't appeared
:(("); //$NON-NLS-1$
- }
-
- assertEquals(TEST_SHELL_NAME, resultObject.getShellName());
- assertEquals(TEST_STRING, resultObject.getTextLabel());
-
- resultObject = startCheckerThread();
-
- openPage(JsfAllTests.IMPORT_PROJECT_NAME, SECOND_TEST_PAGE_NAME);
-
- if (!"".equals(resultObject.getShellName()) ||
!"".equals(resultObject.getTextLabel())) { //$NON-NLS-1$ //$NON-NLS-2$
- throw new Exception("Unexpected shell has appeared " + "\"" +
resultObject.getShellName() + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
- }
-
- }
-
- private class ResultObject {
- private String shellName = ""; //$NON-NLS-1$
- private String textLabel = ""; //$NON-NLS-1$
-
- public String getShellName() {
- return shellName;
- }
-
- public void setShellName(String shellName) {
- this.shellName = shellName;
- }
-
- public String getTextLabel() {
- return textLabel;
- }
-
- public void setTextLabel(String textLabel) {
- this.textLabel = textLabel;
- }
-
- }
-
- private ResultObject startCheckerThread() {
- final Shell[] shell = new Shell[1];
- final ResultObject resultObject = new ResultObject();
- Thread thread = new Thread(new Runnable() {
- public void run() {
- TestUtil.waitForIdle();
- while (shell[0] == null && isCheckNeed) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- Shell[] shells = Display.getCurrent().getShells();
- shell[0] = findShellWithText(shells, TEST_SHELL_NAME);
- if (shell[0] != null) {
- resultObject.setShellName(TEST_SHELL_NAME);
- Label label = (Label)shell[0].getChildren()[1];
- resultObject.setTextLabel(label.getText());
- shell[0].close();
- }
- }
- });
- }
- }
- });
- thread.start();
- return resultObject;
- }
-
- private static Shell findShellWithText (Shell[] shells, String text){
- for (int i = 0; i < shells.length; i++) {
- if (text.equals(shells[i].getText())) {
- return shells[i];
- }
- }
- return null;
- }
-
- private void openPage(String projectName, String pagePath) throws Throwable{
- IFile file = (IFile) TestUtil.getComponentPath(pagePath, projectName);
-
- assertNotNull("Could not open specified file. componentPage = "
//$NON-NLS-1$
- + pagePath
- + ";projectName = " + projectName, file);//$NON-NLS-1$
-
- IEditorInput input = new FileEditorInput(file);
-
- assertNotNull("Editor input is null", input); //$NON-NLS-1$
- // open and get editor
-
- JSPMultiPageEditor part = openEditor(input);
-
- isCheckNeed = false;
-
- assertNotNull("Editor is not opened", part); //$NON-NLS-1$
-
- TestUtil.delay(3000);
-
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- System.setProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER",
"true"); //$NON-NLS-1$ //$NON-NLS-2$
-
JspEditorPlugin.getDefault().getPreferenceStore().setValue(IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE,
true);
- }
-
- @Override
- protected void tearDown() throws Exception {
- JspEditorPlugin.getDefault().getPreferenceStore().setValue(IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE,
false);
- System.setProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER",
"false"); //$NON-NLS-1$ //$NON-NLS-2$
- super.tearDown();
- }
-
-}
\ No newline at end of file