Author: yzhishko
Date: 2010-04-02 11:07:28 -0400 (Fri, 02 Apr 2010)
New Revision: 21240
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/
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/ProjectNaturesChecker.java
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/ProjectNaturesPartListener.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/check/
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6125 - completed
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-02
13:04:21 UTC (rev 21239)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/JsfUiPlugin.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -12,12 +12,18 @@
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$
public JsfUiPlugin() {
@@ -25,6 +31,8 @@
public void start(BundleContext context) throws Exception {
super.start(context);
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ window.getPartService().addPartListener(partListener);
}
public static JsfUiPlugin getDefault() {
@@ -49,4 +57,18 @@
public static IPluginLog getPluginLog() {
return getDefault();
}
+
+ @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);
+ }
+
}
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/AddJSFCapabilitiesDelegate.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -0,0 +1,22 @@
+package org.jboss.tools.jsf.ui.editor.check;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jsf.ui.action.AddJSFNatureActionDelegate;
+
+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;
+ }
+
+}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
(from rev 21188,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/check/ProjectNaturesChecker.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesChecker.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * 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.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.util.FileUtil;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
+import org.jboss.tools.jst.web.project.WebProject;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class ProjectNaturesChecker implements IResourceChangeListener {
+
+ 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_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(){
+ if (checker == null) {
+ checker = new ProjectNaturesChecker();
+ }
+ return checker;
+ }
+
+ private ProjectNaturesChecker() {
+ projectsCollection = new HashSet<IProject>(0);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
+ IResourceChangeEvent.POST_CHANGE);
+ }
+
+ public void resourceChanged(final IResourceChangeEvent event) {
+ Display display = Display.getDefault();
+ if (display != null) {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ handleResourceChangeEvent(event);
+ }
+ });
+ }
+ }
+
+ public void checkNatures(IProject project) throws CoreException {
+ if (project == null) {
+ return;
+ }
+ addProject(project);
+ boolean isJSFCheck = true;
+ boolean isNaturesCheck = true;
+ updateProjectPersistentProperties(project);
+ isJSFCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_JSF_CHECK_NEED));
+ isNaturesCheck = Boolean.parseBoolean(project
+ .getPersistentProperty(IS_NATURES_CHECK_NEED));
+ if (isJSFCheck) {
+ if (isNaturesCheck) {
+ String[] missingNatures = getMissingNatures(project);
+ if (missingNatures != null) {
+ KbProject.checkKBBuilderInstalled(project);
+ ProjectNaturesInfoDialog dialog = new ProjectNaturesInfoDialog(
+ missingNatures, project);
+ dialog.open();
+ }
+ }
+ }
+ }
+
+ private String[] getMissingNatures(IProject project) throws CoreException {
+ List<String> missingNatures = new ArrayList<String>(0);
+ 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);
+ }
+ if (missingNatures.size() == 0) {
+ return null;
+ }
+ return missingNatures.toArray(new String[0]);
+ }
+
+ private void handleResourceChangeEvent(IResourceChangeEvent changeEvent) {
+ IResourceDelta[] affectedChildren = changeEvent.getDelta()
+ .getAffectedChildren();
+ if (affectedChildren == null) {
+ return;
+ }
+ for (int i = 0; i < affectedChildren.length; i++) {
+ IResourceDelta resourceDelta = affectedChildren[i];
+ if (resourceDelta.getResource() instanceof IProject) {
+ IProject project = (IProject) resourceDelta.getResource();
+ if (resourceDelta.getKind() == IResourceDelta.ADDED) {
+ processAddProject(project);
+ continue;
+ }
+ if (resourceDelta.getKind() == IResourceDelta.REMOVED) {
+ processRemoveProject(project);
+ continue;
+ }
+ try {
+ updateProjectJSFPersistents(project);
+ } catch (CoreException e) {
+ ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, e);
+ }
+ }
+ }
+ }
+
+ private void updateProjectPersistentProperties(IProject project)
+ throws CoreException {
+ if (project.isAccessible()) {
+ String jsfCheckString = project
+ .getPersistentProperty(IS_JSF_CHECK_NEED);
+ if (jsfCheckString == null) {
+ updateProjectJSFPersistents(project);
+ }
+ if (project.getPersistentProperty(IS_NATURES_CHECK_NEED) == null) {
+ project.setPersistentProperty(IS_NATURES_CHECK_NEED, "true");
//$NON-NLS-1$
+ }
+ }
+ }
+
+ public IProject getProject(IProject project) {
+ return projectsCollection.contains(project) ? project : null;
+ }
+
+ public void addProject(IProject project) {
+ if (getProject(project) == null) {
+ projectsCollection.add(project);
+ }
+ }
+
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ projectsCollection.clear();
+ }
+
+ private void processAddProject(IProject project) {
+ addProject(project);
+ try {
+ updateProjectJSFPersistents(project);
+ } catch (CoreException e) {
+ ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, e);
+ }
+ }
+
+ private void processRemoveProject(IProject project) {
+ projectsCollection.remove(project);
+ }
+
+ private void updateProjectJSFPersistents(IProject project)
+ throws CoreException {
+ if (project.isAccessible()) {
+ try {
+ IJavaElement javaElement = FileUtil.searchForClass(JavaCore
+ .create(project), SEARCH_CLASS);
+ if (javaElement == null) {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "false"); //$NON-NLS-1$
+ } else {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "true"); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ project.setPersistentProperty(IS_JSF_CHECK_NEED, "false"); //$NON-NLS-1$
+ }
+ }
+ }
+
+}
Copied:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java
(from rev 21188,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/check/ProjectNaturesInfoDialog.java)
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesInfoDialog.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * 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.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;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Control;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class ProjectNaturesInfoDialog extends MessageDialog {
+
+ private Button button;
+ private Link link;
+ private 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;
+
+ public ProjectNaturesInfoDialog(String[] missingNatures, IProject project) {
+ super(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ TITLE, null, "", INFORMATION, //$NON-NLS-1$
+ new String[] {"Add JSF Capabilities...", IDialogConstants.OK_LABEL }, 0);
//$NON-NLS-1$
+ this.project = project;
+ message = getMessageInfo(missingNatures, project);
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+
+ GridLayout gridLayout = (GridLayout) parent.getLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.makeColumnsEqualWidth = true;
+ parent.setLayout(gridLayout);
+ button = new Button(parent, SWT.CHECK);
+ GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ button.setLayoutData(gridData);
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ isRemember = !isRemember;
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ isRemember = !isRemember;
+ }
+ });
+ button.setText(QUESTION);
+ link = new Link(parent, SWT.NONE);
+ gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ gridData.grabExcessHorizontalSpace = true;
+ link.setLayoutData(gridData);
+ link.setText("<A>" + JstUIMessages.DOCS_INFO_LINK_TEXT +
"</A>"); //$NON-NLS-1$ //$NON-NLS-2$
+ link.setToolTipText(JstUIMessages.DOCS_INFO_LINK);
+ link.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ processLink(link);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ processLink(link);
+ }
+
+ });
+ return parent;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == 0) {
+ BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
+ public void run() {
+ AddJSFCapabilitiesDelegate.getInstance(project).run(null);
+ }
+ });
+ }
+ if (buttonId == 1) {
+ try {
+ project.setPersistentProperty(
+ ProjectNaturesChecker.IS_NATURES_CHECK_NEED, Boolean
+ .toString(!isRemember));
+ } catch (CoreException e) {
+ }
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ private void processLink(Link link) {
+ BusyIndicator.showWhile(link.getDisplay(), new Runnable() {
+ public void run() {
+ URL theURL = null;
+ try {
+ theURL = new URL(JstUIMessages.DOCS_INFO_LINK);
+ } catch (MalformedURLException e) {
+ ProblemReportingHelper.reportProblem(
+ JspEditorPlugin.PLUGIN_ID, e);
+ }
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench()
+ .getBrowserSupport();
+ try {
+ support.getExternalBrowser().openURL(theURL);
+ } catch (PartInitException e) {
+ ProblemReportingHelper.reportProblem(
+ JspEditorPlugin.PLUGIN_ID, e);
+ }
+ }
+ });
+ }
+
+ @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();
+ }
+
+ 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;
+ }
+
+}
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesPartListener.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesPartListener.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/check/ProjectNaturesPartListener.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -0,0 +1,66 @@
+package org.jboss.tools.jsf.ui.editor.check;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+
+public class ProjectNaturesPartListener implements IPartListener {
+
+ public void partActivated(IWorkbenchPart part) {
+
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+
+ }
+
+ public void partClosed(IWorkbenchPart part) {
+
+ }
+
+ public void partDeactivated(IWorkbenchPart part) {
+
+ }
+
+ public void partOpened(IWorkbenchPart part) {
+ boolean isCheck = true;
+ String isCheckString = System
+ .getProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER");
//$NON-NLS-1$
+ if (isCheckString != null) {
+ isCheck = Boolean.parseBoolean(isCheckString);
+ }
+ if (isCheck) {
+ if (JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getBoolean(
+ IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE))
{
+ try {
+ checkNaturesFromPart(part);
+ } catch (CoreException e) {
+ ProblemReportingHelper.reportProblem(
+ JspEditorPlugin.PLUGIN_ID, e);
+ }
+ }
+ }
+ }
+
+ private void checkNaturesFromPart(IWorkbenchPart part) throws CoreException {
+ if (part instanceof JSPMultiPageEditor) {
+ IEditorInput editorInput = ((JSPMultiPageEditor)part).getEditorInput();
+ if (editorInput instanceof IFileEditorInput) {
+ ProjectNaturesChecker.getInstance()
+ .checkNatures(
+ ((IFileEditorInput) editorInput).getFile()
+ .getProject());
+ }
+ }
+ }
+
+}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java 2010-04-02
13:04:21 UTC (rev 21239)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JspEditorPlugin.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -14,7 +14,6 @@
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
-
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -24,8 +23,6 @@
import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
@@ -35,10 +32,8 @@
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
import org.jboss.tools.common.text.xml.XmlEditorPlugin;
-import org.jboss.tools.jst.jsp.check.ProjectNaturesChecker;
import org.jboss.tools.jst.jsp.preferences.JSPOccurrencePreferenceConstants;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
@@ -281,12 +276,5 @@
}
return fImageDescRegistry;
}
-
- @Override
- public void stop(BundleContext context) throws Exception {
- ProjectNaturesChecker naturesChecker = ProjectNaturesChecker.getInstance();
- naturesChecker.dispose();
- naturesChecker = null;
- super.stop(context);
- }
+
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-04-02
13:04:21 UTC (rev 21239)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-04-02
15:07:28 UTC (rev 21240)
@@ -48,7 +48,6 @@
import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.check.ProjectNaturesChecker;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
/**
@@ -60,8 +59,6 @@
private ArrayList nestedEditors = new ArrayList(3);
- private ActivationListener activationListener = new ActivationListener();
-
protected JSPMultiPageEditorPart() {
super();
}
@@ -133,8 +130,6 @@
public final void createPartControl(Composite parent) {
this.container = createContainer(parent);
createPages();
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().addPartListener(activationListener);
// set the active page (page 0 by default), unless it has already been
// done
if (getActivePage() == -1)
@@ -144,11 +139,6 @@
protected abstract IEditorSite createSite(IEditorPart editor);
public void dispose() {
- if (activationListener != null) {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(activationListener);
- activationListener = null;
- }
getSite().setSelectionProvider(null);
for (int i = 0; i < nestedEditors.size(); ++i) {
IEditorPart editor = (IEditorPart) nestedEditors.get(i);
@@ -345,17 +335,6 @@
getItem(pageIndex).setText(text);
}
- private void checkNaturesFromPart(IWorkbenchPart part) throws CoreException {
- if (part == this) {
- IEditorInput editorInput = getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- ProjectNaturesChecker.getInstance()
- .checkNatures(
- ((IFileEditorInput) editorInput).getFile()
- .getProject());
- }
- }
- }
private class ActivationListener implements IPartListener {
@@ -376,26 +355,7 @@
}
public void partOpened(IWorkbenchPart part) {
- boolean isCheck = true;
- String isCheckString = System
- .getProperty("org.jboss.tools.vpe.ENABLE_PROJECT_NATURES_CHECKER");
//$NON-NLS-1$
- if (isCheckString != null) {
- isCheck = Boolean.parseBoolean(isCheckString);
- }
- if (isCheck) {
- if (JspEditorPlugin
- .getDefault()
- .getPreferenceStore()
- .getBoolean(
- IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE))
{
- try {
- checkNaturesFromPart(part);
- } catch (CoreException e) {
- ProblemReportingHelper.reportProblem(
- JspEditorPlugin.PLUGIN_ID, e);
- }
- }
- }
+
}
}
}