org.eclipse.jface.operation.IRunnableContext Java Examples

The following examples show how to use org.eclipse.jface.operation.IRunnableContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JarPackagerUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Tells whether the specified manifest main class is valid.
 * 
 * @param data the Jar package data
 * @param context the runnable context
 * @return <code>true</code> if a main class is specified and valid
 */
public static boolean isMainClassValid(JarPackageData data, IRunnableContext context) {
	if (data == null)
		return false;

	IType mainClass= data.getManifestMainClass();
	if (mainClass == null)
		// no main class specified
		return true;

	try {
		// Check if main method is in scope
		IFile file= (IFile)mainClass.getResource();
		if (file == null || !contains(asResources(data.getElements()), file))
			return false;

		// Test if it has a main method
		return JavaModelUtil.hasMainMethod(mainClass);
	} catch (JavaModelException e) {
		JavaPlugin.log(e.getStatus());
	}
	return false;
}
 
Example #2
Source File: RefactoringWizardOpenOperation_NonForking.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * CHANGED to protected
 * CHANGED do not fork as we are keeping the resource lock.
 */
protected RefactoringStatus checkInitialConditions(Refactoring refactoring, Shell parent, String title,
		IRunnableContext context) throws InterruptedException {
	try {
		CheckConditionsOperation cco = new CheckConditionsOperation(refactoring,
				CheckConditionsOperation.INITIAL_CONDITONS);
		WorkbenchRunnableAdapter workbenchRunnableAdapter = new WorkbenchRunnableAdapter(cco, ResourcesPlugin
				.getWorkspace().getRoot());
		/* CHANGE: don't fork (or use busyCursorWhile) as this will cause a deadlock */
		if (context == null) {
			PlatformUI.getWorkbench().getProgressService().run(false, true, workbenchRunnableAdapter);
		} else if (context instanceof IProgressService) {
			((IProgressService) context).run(false, true, workbenchRunnableAdapter);
		} else {
			context.run(false, true, workbenchRunnableAdapter);
		}
		return cco.getStatus();
	} catch (InvocationTargetException e) {
		ExceptionHandler.handle(e, parent, title, RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
		return RefactoringStatus
				.createFatalErrorStatus(RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
	}
}
 
Example #3
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
	if (launchconfig == null)
		return new Object[0];

	String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$

	IPath[] classpath= getClasspath(launchconfig);
	IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);

	String mainClass= getMainClass(launchconfig, status);
	IType mainType= findMainMethodByName(mainClass, classpathResources, context);
	if (mainType == null) {
		status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
	}
	data.setManifestMainClass(mainType);

	return classpathResources;
}
 
Example #4
Source File: RenameSupport.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Executes the rename refactoring without showing a dialog to gather
 * additional user input (for example the new name of the <tt>IJavaElement</tt>).
 * Only an error dialog is shown (if necessary) to present the result
 * of the refactoring's full precondition checking.
 * <p>
 * The method has to be called from within the UI thread.
 * </p>
 *
 * @param parent a shell used as a parent for the error dialog.
 * @param context a {@link IRunnableContext} to execute the operation.
 *
 * @throws InterruptedException if the operation has been canceled by the
 * user.
 * @throws InvocationTargetException if an error occurred while executing the
 * operation.
 *
 * @see #openDialog(Shell)
 * @see IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
 */
public void perform(Shell parent, IRunnableContext context) throws InterruptedException, InvocationTargetException {
	try {
		ensureChecked();
		if (fPreCheckStatus.hasFatalError()) {
			showInformation(parent, fPreCheckStatus);
			return;
		}

		RenameSelectionState state= createSelectionState();

		RefactoringExecutionHelper helper= new RefactoringExecutionHelper(fRefactoring,
				RefactoringCore.getConditionCheckingFailedSeverity(),
				getJavaRenameProcessor().getSaveMode(),
				parent,
				context);
		helper.perform(true, true);

		restoreSelectionState(state);
	} catch (CoreException e) {
		throw new InvocationTargetException(e);
	}
}
 
Example #5
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
public Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
	if (launchconfig == null)
		return new Object[0];

	String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$

	IPath[] classpath= getClasspath(launchconfig);
	IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);

	String mainClass= getMainClass(launchconfig, status);
	IType mainType= findMainMethodByName(mainClass, classpathResources, context);
	if (mainType == null) {
		status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
	}
	data.setManifestMainClass(mainType);

	return classpathResources;
}
 
Example #6
Source File: ImportOrganizeInputDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title);
		dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message);
	}
}
 
Example #7
Source File: MainMethodSearchEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Searches for all main methods in the given scope.
 * Valid styles are IJavaElementSearchConstants.CONSIDER_BINARIES and
 * IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS
 * @param context runnable context
 * @param scope the search scope
 * @param style style search style constants (see {@link IJavaElementSearchConstants})
 * @return the types found
 * @throws InvocationTargetException
 * @throws InterruptedException
 */
public IType[] searchMainMethods(IRunnableContext context, final IJavaSearchScope scope, final int style) throws InvocationTargetException, InterruptedException  {
	int allFlags=  IJavaElementSearchConstants.CONSIDER_EXTERNAL_JARS | IJavaElementSearchConstants.CONSIDER_BINARIES;
	Assert.isTrue((style | allFlags) == allFlags);

	final IType[][] res= new IType[1][];

	IRunnableWithProgress runnable= new IRunnableWithProgress() {
		public void run(IProgressMonitor pm) throws InvocationTargetException {
			try {
				res[0]= searchMainMethods(pm, scope, style);
			} catch (CoreException e) {
				throw new InvocationTargetException(e);
			}
		}
	};
	context.run(true, true, runnable);

	return res[0];
}
 
Example #8
Source File: ProblemSeveritiesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void doBrowseTypes(StringButtonDialogField dialogField) {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, dialogField.getText());
		dialog.setTitle(PreferencesMessages.NullAnnotationsConfigurationDialog_browse_title);
		dialog.setMessage(PreferencesMessages.NullAnnotationsConfigurationDialog_choose_annotation);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			dialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.NullAnnotationsConfigurationDialog_error_title, PreferencesMessages.NullAnnotationsConfigurationDialog_error_message);
	}
}
 
Example #9
Source File: MultiMainTypeSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructor.
 */
public MultiMainTypeSelectionDialog(Shell shell, IRunnableContext context,
	IJavaSearchScope scope, int style)
{
	super(shell, new JavaElementLabelProvider(
		JavaElementLabelProvider.SHOW_PARAMETERS | JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));

	setMultipleSelection(true);

	Assert.isNotNull(context);
	Assert.isNotNull(scope);

	fRunnableContext= context;
	fScope= scope;
	fStyle= style;
}
 
Example #10
Source File: RefactoringExecutionHelper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new refactoring execution helper.
 *
 * @param refactoring the refactoring
 * @param stopSeverity a refactoring status constant from {@link RefactoringStatus}
 * @param saveMode a save mode from {@link RefactoringSaveHelper}
 * @param parent the parent shell
 * @param context the runnable context
 */
public RefactoringExecutionHelper(Refactoring refactoring, int stopSeverity, int saveMode, Shell parent, IRunnableContext context) {
	super();
	Assert.isNotNull(refactoring);
	Assert.isNotNull(parent);
	Assert.isNotNull(context);
	fRefactoring= refactoring;
	fStopSeverity= stopSeverity;
	fParent= parent;
	fExecContext= context;
	fSaveMode= saveMode;
}
 
Example #11
Source File: NewSourceContainerWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
   * Constructor of the <code>NewSourceContainerWorkbookPage</code> which consists of
   * a tree representing the project, a toolbar with the available actions, an area
   * containing hyperlinks that perform the same actions as those in the toolbar but
   * additionally with some short description.
   *
   * @param classPathList
   * @param outputLocationField
   * @param context a runnable context, can be <code>null</code>
   * @param buildPathsBlock
   */
  public NewSourceContainerWorkbookPage(ListDialogField<CPListElement> classPathList, StringDialogField outputLocationField, IRunnableContext context, BuildPathsBlock buildPathsBlock) {
      fClassPathList= classPathList;
fOutputLocationField= outputLocationField;
fContext= context;
fBuildPathsBlock= buildPathsBlock;

      fUseFolderOutputs= new SelectionButtonDialogField(SWT.CHECK);
      fUseFolderOutputs.setSelection(false);
      fUseFolderOutputs.setLabelText(NewWizardMessages.SourceContainerWorkbookPage_folders_check);

fPackageExplorer= new DialogPackageExplorer();
fHintTextGroup= new HintTextGroup();
   }
 
Example #12
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
protected static IType findMainMethodByName(String name, IPackageFragmentRoot[] classpathResources, IRunnableContext context) {

		List<IResource> resources= JarPackagerUtil.asResources(classpathResources);
		if (resources == null) {
			return null;
		}

		for (Iterator<IResource> iterator= resources.iterator(); iterator.hasNext();) {
			IResource element= iterator.next();
			if (element == null)
				iterator.remove();
		}

		IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(resources.toArray(new IResource[resources.size()]), true);
		MainMethodSearchEngine engine= new MainMethodSearchEngine();
		try {
			IType[] mainTypes= engine.searchMainMethods(context, searchScope, 0);
			for (int i= 0; i < mainTypes.length; i++) {
				if (mainTypes[i].getFullyQualifiedName().equals(name))
					return mainTypes[i];
			}
		} catch (InvocationTargetException ex) {
			JavaPlugin.log(ex);
		} catch (InterruptedException e) {
			// null
		}

		return null;
	}
 
Example #13
Source File: SVNModelElement.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the runnableContext.
 * @return IRunnableContext
 */
public IRunnableContext getRunnableContext() {
	if (runnableContext == null) {
		return new IRunnableContext() {
			public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
				SVNUIPlugin.runWithProgress(null, cancelable, runnable);
			}
		};
	}
	return runnableContext;
}
 
Example #14
Source File: TypeSelectionDialog2.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public TypeSelectionDialog2(Shell parent, boolean multi, IRunnableContext context, 
		IJavaSearchScope scope, int elementKinds, TypeSelectionExtension extension) {
	super(parent);
	setShellStyle(getShellStyle() | SWT.RESIZE);
	fMultipleSelection= multi;
	fRunnableContext= context;
	fScope= scope;
	fElementKind= elementKinds;
	fSelectionMode= NONE;
	fExtension= extension;
	if (fExtension != null) {
		fValidator= fExtension.getSelectionValidator();
	}
}
 
Example #15
Source File: AddFolderToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private AddFolderToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.ADD_SEL_SF_TO_BP);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_ADD_AS_SOURCE_FOLDER);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelSFToCP_tooltip);
}
 
Example #16
Source File: ReorgCopyStarter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void run(Shell parent) throws InterruptedException, InvocationTargetException {
	IRunnableContext context= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	fCopyProcessor.setNewNameQueries(new NewNameQueries(parent));
	fCopyProcessor.setReorgQueries(new ReorgQueries(parent));
	CopyRefactoring refactoring= new CopyRefactoring(fCopyProcessor);
	new RefactoringExecutionHelper(refactoring, RefactoringCore.getConditionCheckingFailedSeverity(), fCopyProcessor.getSaveMode(), parent, context).perform(false, false);
}
 
Example #17
Source File: RemoveFromBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public RemoveFromBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
super(site, selectionTarget, BuildpathModifierAction.REMOVE_FROM_BP);

fContext= context;

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_label);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_RemoveFromCP_tooltip);
  }
 
Example #18
Source File: ResetAllAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ResetAllAction(HintTextGroup provider, IRunnableContext context, ISetSelectionTarget selectionTarget) {
	super(null, selectionTarget, BuildpathModifierAction.RESET_ALL);

	fProvider= provider;
	fContext= context;

	setImageDescriptor(JavaPluginImages.DESC_ELCL_CLEAR);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CLEAR);
	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_label);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_ClearAll_tooltip);
	setEnabled(false);
}
 
Example #19
Source File: EditOutputFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private EditOutputFolderAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.EDIT_OUTPUT);

	fContext= context;
	fShowOutputFolders= false;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_EditOutput_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_CONFIGURE_OUTPUT_FOLDER);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_EditOutput_tooltip);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CONFIGURE_OUTPUT_FOLDER);
}
 
Example #20
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static IType findMainMethodByName(String name, IPackageFragmentRoot[] classpathResources, IRunnableContext context) {

		List<IResource> resources= JarPackagerUtil.asResources(classpathResources);
		if (resources == null) {
			return null;
		}

		for (Iterator<IResource> iterator= resources.iterator(); iterator.hasNext();) {
			IResource element= iterator.next();
			if (element == null)
				iterator.remove();
		}

		IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(resources.toArray(new IResource[resources.size()]), true);
		MainMethodSearchEngine engine= new MainMethodSearchEngine();
		try {
			IType[] mainTypes= engine.searchMainMethods(context, searchScope, 0);
			for (int i= 0; i < mainTypes.length; i++) {
				if (mainTypes[i].getFullyQualifiedName().equals(name))
					return mainTypes[i];
			}
		} catch (InvocationTargetException ex) {
			JavaPlugin.log(ex);
		} catch (InterruptedException e) {
			// null
		}

		return null;
	}
 
Example #21
Source File: IDEFileReportProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private IRunnableContext getOperationRunner( IProgressMonitor monitor )
{
	if ( fOperationRunner == null )
		fOperationRunner = new WorkspaceOperationRunner( );
	fOperationRunner.setProgressMonitor( monitor );
	return fOperationRunner;
}
 
Example #22
Source File: ResetAllOutputFoldersAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ResetAllOutputFoldersAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context, IJavaProject javaProject) {
super(site, selectionTarget, BuildpathModifierAction.RESET_ALL_OUTPUT_FOLDERS);

fContext= context;
fJavaProject= javaProject;

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
  }
 
Example #23
Source File: AddSelectedLibraryToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private AddSelectedLibraryToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
super(site, selectionTarget, BuildpathModifierAction.ADD_SEL_LIB_TO_BP);

fContext= context;

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_label);
setImageDescriptor(JavaPluginImages.DESC_OBJS_EXTJAR);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddSelLibToCP_tooltip);
  }
 
Example #24
Source File: FilteredTypesSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates new FilteredTypesSelectionDialog instance.
 *
 * @param shell
 *            shell to parent the dialog on
 * @param multi
 *            <code>true</code> if multiple selection is allowed
 * @param context
 *            context used to execute long-running operations associated
 *            with this dialog
 * @param scope
 *            scope used when searching for types. If the scope is <code>null</code>,
 *            then workspace is scope is used as default, and the user can
 *            choose a working set as scope.
 * @param elementKinds
 *            flags defining nature of searched elements; the only valid
 *            values are: <code>IJavaSearchConstants.TYPE</code>
 * 	<code>IJavaSearchConstants.ANNOTATION_TYPE</code>
 * 	<code>IJavaSearchConstants.INTERFACE</code>
 * 	<code>IJavaSearchConstants.ENUM</code>
 * 	<code>IJavaSearchConstants.CLASS_AND_INTERFACE</code>
 * 	<code>IJavaSearchConstants.CLASS_AND_ENUM</code>.
 *            Please note that the bitwise OR combination of the elementary
 *            constants is not supported.
 * @param extension
 *            an extension of the standard type selection dialog; See
 *            {@link TypeSelectionExtension}
 */
public FilteredTypesSelectionDialog(Shell shell, boolean multi, IRunnableContext context, IJavaSearchScope scope, int elementKinds, TypeSelectionExtension extension) {
	super(shell, multi);

	setSelectionHistory(new TypeSelectionHistory());

	if (scope == null) {
		fAllowScopeSwitching= true;
		scope= SearchEngine.createWorkspaceScope();
	}

	fElementKinds= elementKinds;
	fExtension= extension;
	fFilterExtension= (extension == null) ? null : extension.getFilterExtension();
	fSearchScope= scope;

	if (extension != null) {
		fValidator= extension.getSelectionValidator();
	}

	fTypeInfoUtil= new TypeInfoUtil(extension != null ? extension.getImageProvider() : null);

	fTypeInfoLabelProvider= new TypeItemLabelProvider();
	
	setListLabelProvider(fTypeInfoLabelProvider);
	setListSelectionLabelDecorator(fTypeInfoLabelProvider);

	setDetailsLabelProvider(new TypeItemDetailsLabelProvider(fTypeInfoUtil));

	fTypeItemsComparator= new TypeItemsComparator();
}
 
Example #25
Source File: EditFilterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private EditFilterAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.EDIT_FILTERS);

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_CONFIGURE_BUILDPATH_FILTERS);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Edit_tooltip);
	setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_Edit);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_CONFIGURE_BUILDPATH_FILTERS);
}
 
Example #26
Source File: ImportOrganizeInputDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
final void doBrowsePackages() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= PackageSelectionDialog.F_REMOVE_DUPLICATES | PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE;
	PackageSelectionDialog dialog= new PackageSelectionDialog(getShell(), context, style, scope);
	dialog.setFilter(fNameDialogField.getText());
	dialog.setIgnoreCase(false);
	dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_title);
	dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_description);
	dialog.setEmptyListMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_empty);
	if (dialog.open() == Window.OK) {
		IPackageFragment res= (IPackageFragment) dialog.getFirstResult();
		fNameDialogField.setText(res.getElementName());
	}
}
 
Example #27
Source File: AddArchiveToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private AddArchiveToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.ADD_LIB_TO_BP);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddJarCP_label);
	setImageDescriptor(JavaPluginImages.DESC_OBJS_EXTJAR);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip);
}
 
Example #28
Source File: CreateSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private CreateSourceFolderAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.CREATE_FOLDER);

	setText(ActionMessages.OpenNewSourceFolderWizardAction_text2);
	setDescription(ActionMessages.OpenNewSourceFolderWizardAction_description);
	setToolTipText(ActionMessages.OpenNewSourceFolderWizardAction_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_TOOL_NEWPACKROOT);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_SOURCEFOLDER_WIZARD_ACTION);
}
 
Example #29
Source File: RunnableContextUtils.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void runOperationInWorkspace(IRunnableContext context, boolean isCancellable, Operation op) 
		throws OperationCancellation, CommonException {
	
	runOperation(context, (pm) -> {
		ResourceUtils.runOperation(ResourceUtils.getWorkspaceRoot(), pm, op);
	}, isCancellable);
}
 
Example #30
Source File: CreateLinkedSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private CreateLinkedSourceFolderAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.CREATE_LINK);

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_label);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Link_tooltip);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_ADD_LINKED_SOURCE_TO_BUILDPATH);
	setDescription(NewWizardMessages.PackageExplorerActionGroup_FormText_createLinkedFolder);
}