Author: dazarov
Date: 2011-03-18 19:55:10 -0400 (Fri, 18 Mar 2011)
New Revision: 29911
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
Log:
https://issues.jboss.org/browse/JBIDE-8201
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -1633,7 +1633,7 @@
if (Flags.isPublic(field.getFlags()) && !Flags.isStatic(field.getFlags()))
{
ITextSourceReference fieldReference =
CDIUtil.convertToSourceReference(field.getNameRange());
addError(CDIValidationMessages.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD,
CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN,
- fieldReference, bean.getResource());
+ fieldReference, bean.getResource(),
ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD_ID);
}
}
/*
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -27,6 +27,7 @@
public static final int UNSATISFIED_INJECTION_POINTS_ID = 7;
public static final int AMBIGUOUS_INJECTION_POINTS_ID = 8;
public static final int NOT_PASSIVATION_CAPABLE_BEAN_ID = 9;
+ public static final int ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD_ID = 10;
/*
* (non-Javadoc)
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -93,7 +93,12 @@
public static String MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE;
public static String SELECT_BEAN_TITLE;
public static String ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE;
+ public static String MAKE_BEAN_SCOPED_DEPENDENT_MARKER_RESOLUTION_TITLE;
+ public static String MAKE_FIELD_PROTECTED_MARKER_RESOLUTION_TITLE;
+ public static String QUESTION;
+ public static String DECREASING_FIELD_VISIBILITY_MAY_CAUSE_COMPILATION_PROBLEMS;
+
public static String SELECT_BEAN_WIZARD_TITLE;
public static String SELECT_BEAN_WIZARD_ENTER_BEAN_NAME;
public static String SELECT_BEAN_WIZARD_SELECT_BEAN;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-18
23:55:10 UTC (rev 29911)
@@ -77,7 +77,13 @@
MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE=Specify ''{0}'' bean for injection
to the injection point
SELECT_BEAN_TITLE=Select bean to configure the injection point
ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE=Add java.io.Serializable interface to
''{0}'' class
+MAKE_BEAN_SCOPED_DEPENDENT_MARKER_RESOLUTION_TITLE=Make ''{0}'' bean
scoped @Dependent
+MAKE_FIELD_PROTECTED_MARKER_RESOLUTION_TITLE=Make ''{0}'' field
protected
+QUESTION=Question
+DECREASING_FIELD_VISIBILITY_MAY_CAUSE_COMPILATION_PROBLEMS=Decreasing field visibility
may cause compilation problems. Do you want to continue?
+
+
SELECT_BEAN_WIZARD_TITLE=Specify CDI Bean for the Injection Point
SELECT_BEAN_WIZARD_ENTER_BEAN_NAME=Enter CDI Bean name prefix or pattern (? = any
character, * = any string):
SELECT_BEAN_WIZARD_SELECT_BEAN=Select CDI Bean:
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.ui.marker;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -155,6 +156,26 @@
new AddSerializableInterfaceMarkerResolution(type, file)
};
}
+ }else if(messageId ==
CDIValidationErrorManager.ILLEGAL_SCOPE_FOR_MANAGED_BEAN_WITH_PUBLIC_FIELD_ID){
+ IField field = findPublicField(file, start);
+ CDICoreNature cdiNature = CDIUtil.getCDINatureWithProgress(file.getProject());
+ if(cdiNature != null){
+ ICDIProject cdiProject = cdiNature.getDelegate();
+
+ if(cdiProject != null){
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Iterator<IBean> iter = beans.iterator();
+ if(iter.hasNext()){
+ IBean bean = iter.next();
+ if(field != null){
+ return new IMarkerResolution[] {
+ new MakeFieldProtectedMarkerResolution(field, file)//,
+ //new MakeBeanScopedDependentMarkerResolution(bean, file)
+ };
+ }
+ }
+ }
+ }
}
}
return new IMarkerResolution[] {};
@@ -317,6 +338,21 @@
}
return null;
}
+
+ private IField findPublicField(IFile file, int start){
+ try{
+ IJavaElement javaElement = findJavaElement(file, start);
+
+ if(javaElement != null && javaElement instanceof IField){
+ IField field = (IField)javaElement;
+ if(Flags.isPublic(field.getFlags()) && !field.isBinary())
+ return field;
+ }
+ }catch(JavaModelException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
public boolean hasResolutions(IMarker marker) {
try {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -17,12 +17,10 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.internal.Workbench;
import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.wizard.DeletePreviewWizard;
/**
* @author Daniel Azarov
@@ -47,8 +45,7 @@
DeleteAllDisposerAnnotationsProcessor processor = new
DeleteAllDisposerAnnotationsProcessor(file, method, label);
ProcessorBasedRefactoring refactoring = new ProcessorBasedRefactoring(processor);
DeletePreviewWizard wizard = new DeletePreviewWizard(refactoring);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ //RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
wizard.showWizard();
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -18,13 +18,10 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.internal.Workbench;
import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.wizard.DeletePreviewWizard;
/**
* @author Daniel Azarov
@@ -58,7 +55,7 @@
DeleteAllInjectedConstructorsProcessor processor = new
DeleteAllInjectedConstructorsProcessor(file, method, label);
ProcessorBasedRefactoring refactoring = new ProcessorBasedRefactoring(processor);
DeletePreviewWizard wizard = new DeletePreviewWizard(refactoring);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ //RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
wizard.showWizard();
}
Deleted:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.cdi.ui.marker;
-
-import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
-import org.eclipse.jdt.ui.refactoring.RefactoringSaveHelper;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class DeletePreviewWizard extends RefactoringWizard {
-
- public DeletePreviewWizard(Refactoring refactoring) {
- super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
- //setForcePreviewReview(false);
- }
-
- @Override
- protected void addUserInputPages() {
- }
-
- public boolean showWizard() {
- final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final Shell shell = win.getShell();
- final RefactoringStarter refactoringStarter = new RefactoringStarter();
- boolean res = refactoringStarter.activate(this, shell, getWindowTitle(),
RefactoringSaveHelper.SAVE_ALL);
- //RefactoringStatus rs = refactoringStarter.getInitialConditionCheckingStatus();
- return res;
- }
-
-
-}
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution2;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MakeBeanScopedDependentMarkerResolution implements IMarkerResolution2{
+ private String label;
+ private IBean bean;
+ private IFile file;
+
+ public MakeBeanScopedDependentMarkerResolution(IBean bean, IFile file){
+ this.label =
MessageFormat.format(CDIUIMessages.MAKE_BEAN_SCOPED_DEPENDENT_MARKER_RESOLUTION_TITLE, new
Object[]{bean.getBeanClass().getElementName()});
+ this.bean = bean;
+ this.file = file;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public void run(IMarker marker) {
+ }
+
+ @Override
+ public String getDescription() {
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.EclipseUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MakeFieldProtectedMarkerResolution implements IMarkerResolution2{
+ private static final String PUBLIC = "public"; //$NON-NLS-1$
+ private static final String PROTECTED = "protected"; //$NON-NLS-1$
+
+ private String label;
+ private IField field;
+ private IFile file;
+
+ public MakeFieldProtectedMarkerResolution(IField field, IFile file){
+ this.label =
MessageFormat.format(CDIUIMessages.MAKE_FIELD_PROTECTED_MARKER_RESOLUTION_TITLE, new
Object[]{field.getElementName()});
+ this.field = field;
+ this.file = file;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public void run(IMarker marker) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ boolean cont = MessageDialog.openQuestion(shell, CDIUIMessages.QUESTION,
CDIUIMessages.DECREASING_FIELD_VISIBILITY_MAY_CAUSE_COMPILATION_PROBLEMS);
+ if(!cont)
+ return;
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new
NullProgressMonitor());
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ int flag = field.getFlags();
+
+ String text = buffer.getText(field.getSourceRange().getOffset(),
field.getSourceRange().getLength());
+
+ int position = field.getSourceRange().getOffset();
+ if((flag & Flags.AccPublic) != 0){
+ position += text.indexOf(PUBLIC);
+ buffer.replace(position, PUBLIC.length(), PROTECTED);
+ }
+
+ compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
+ compilationUnit.discardWorkingCopy();
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -22,7 +22,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -61,7 +61,7 @@
private void internal_run(IMarker marker, boolean test) {
if(checkBeans()){
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
AddQualifiersToBeanWizard wizard = new AddQualifiersToBeanWizard(injectionPoint,
beans, selectedBean);
WizardDialog dialog = new WizardDialog(shell, wizard);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.ui.marker;
import java.text.MessageFormat;
-import java.util.HashSet;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -20,9 +19,7 @@
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-03-18
18:53:42 UTC (rev 29910)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -20,7 +20,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -55,7 +55,7 @@
}
private void internal_run(IMarker marker, boolean test) {
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
SelectBeanWizard wizard = new SelectBeanWizard(injectionPoint, beans);
WizardDialog dialog = new WizardDialog(shell, wizard);
Copied:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
(from rev 29904,
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java)
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java 2011-03-18
23:55:10 UTC (rev 29911)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.wizard;
+
+import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
+import org.eclipse.jdt.ui.refactoring.RefactoringSaveHelper;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class DeletePreviewWizard extends RefactoringWizard {
+
+ public DeletePreviewWizard(Refactoring refactoring) {
+ super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
+ //setForcePreviewReview(false);
+ }
+
+ @Override
+ protected void addUserInputPages() {
+ }
+
+ public boolean showWizard() {
+ final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ final Shell shell = win.getShell();
+ final RefactoringStarter refactoringStarter = new RefactoringStarter();
+ boolean res = refactoringStarter.activate(this, shell, getWindowTitle(),
RefactoringSaveHelper.SAVE_ALL);
+ //RefactoringStatus rs = refactoringStarter.getInitialConditionCheckingStatus();
+ return res;
+ }
+
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain