org.eclipse.ui.part.ISetSelectionTarget Java Examples

The following examples show how to use org.eclipse.ui.part.ISetSelectionTarget. 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: 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 #2
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 #3
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 #4
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 #5
Source File: ResetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public ResetAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
super(site, selectionTarget, BuildpathModifierAction.RESET);

fContext= context;

setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Reset_tooltip);
  }
 
Example #6
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 #7
Source File: IncludeToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IncludeToBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.INCLUDE);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_INCLUDE_ON_BUILDPATH);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Unexclude_tooltip);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_INCLUDE_ON_BUILDPATH);
}
 
Example #8
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 #9
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 #10
Source File: ShowInPackageExplorerAction.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void run(IAction action) {
    if (data == null) {
        return;
    }
    IViewPart part = getView(JavaUI.ID_PACKAGES);
    if (part instanceof ISetSelectionTarget) {
        ISetSelectionTarget target = (ISetSelectionTarget) part;
        target.selectReveal(new StructuredSelection(data));
    }
}
 
Example #11
Source File: BuildpathModifierAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public BuildpathModifierAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, int id, int style) {
super("", style); //$NON-NLS-1$

fSite= site;
fSelectionTarget= selectionTarget;
fSelectedElements= new ArrayList<Object>();
fListeners= new ArrayList<IBuildpathModifierListener>();

setId(Integer.toString(id));
  }
 
Example #12
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 #13
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);
}
 
Example #14
Source File: UIInterpreterHelper.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Select the given element in the view of the given id
 * 
 * @param element
 */
public static void selectReveal(Object element, String viewId) {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	// Select in the Project Explorer the generated files.
	IViewPart view = page.findView(viewId);
	if (view instanceof ISetSelectionTarget) {
		((ISetSelectionTarget) view).selectReveal(new StructuredSelection(element));
	}
}
 
Example #15
Source File: ShowInNavigatorViewAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void run(IResource resource) {
	if (resource == null)
		return;
	try {
		IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage();
		IViewPart view= page.showView(JavaPlugin.ID_RES_NAV);
		if (view instanceof ISetSelectionTarget) {
			ISelection selection= new StructuredSelection(resource);
			((ISetSelectionTarget)view).selectReveal(selection);
		}
	} catch(PartInitException e) {
		ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.ShowInNavigatorView_error_activation_failed);
	}
}
 
Example #16
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 #17
Source File: ExcludeFromBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private ExcludeFromBuildpathAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, IRunnableContext context) {
	super(site, selectionTarget, BuildpathModifierAction.EXCLUDE);

	fContext= context;

	setText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Exclude_label);
	setImageDescriptor(JavaPluginImages.DESC_ELCL_EXCLUDE_FROM_BUILDPATH);
	setToolTipText(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_Exclude_tooltip);
	setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_EXCLUDE_FROM_BUILDPATH);
}
 
Example #18
Source File: AddArchiveToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public AddArchiveToBuildpathAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #19
Source File: RenameSelectionState.java    From typescript.java with MIT License 4 votes vote down vote up
public void restore(Object newElement) {
	if (fDisplay == null)
		return;
	for (int i = 0; i < fParts.size(); i++) {
		IStructuredSelection currentSelection = (IStructuredSelection) fSelections.get(i);
		boolean changed = false;
		final ISetSelectionTarget target = (ISetSelectionTarget) fParts.get(i);
		final IStructuredSelection[] newSelection = new IStructuredSelection[1];
		newSelection[0] = currentSelection;
		if (currentSelection instanceof TreeSelection) {
			TreeSelection treeSelection = (TreeSelection) currentSelection;
			TreePath[] paths = treeSelection.getPaths();
			for (int p = 0; p < paths.length; p++) {
				TreePath path = paths[p];
				if (path.getSegmentCount() > 0 && path.getLastSegment().equals(fElement)) {
					paths[p] = createTreePath(path, newElement);
					changed = true;
				}
			}
			if (changed) {
				newSelection[0] = new TreeSelection(paths, treeSelection.getElementComparer());
			}
		} else {
			Object[] elements = currentSelection.toArray();
			for (int e = 0; e < elements.length; e++) {
				if (elements[e].equals(fElement)) {
					elements[e] = newElement;
					changed = true;
				}
			}
			if (changed) {
				newSelection[0] = new StructuredSelection(elements);
			}
		}
		if (changed) {
			fDisplay.asyncExec(new Runnable() {
				public void run() {
					target.selectReveal(newSelection[0]);
				}
			});
		}
	}
}
 
Example #20
Source File: RemoveFromBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public RemoveFromBuildpathAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);

setImageDescriptor(JavaPluginImages.DESC_ELCL_REMOVE_AS_SOURCE_FOLDER);
setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_REMOVE_AS_SOURCE_FOLDER);
  }
 
Example #21
Source File: CreateSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public CreateSourceFolderAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #22
Source File: RenameSelectionState.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void restore(Object newElement) {
	if (fDisplay == null)
		return;
	for (int i= 0; i < fParts.size(); i++) {
		IStructuredSelection currentSelection= fSelections.get(i);
		boolean changed= false;
		final ISetSelectionTarget target= (ISetSelectionTarget)fParts.get(i);
		final IStructuredSelection[] newSelection= new IStructuredSelection[1];
		newSelection[0]= currentSelection;
		if (currentSelection instanceof TreeSelection) {
			TreeSelection treeSelection= (TreeSelection)currentSelection;
			TreePath[] paths= treeSelection.getPaths();
			for (int p= 0; p < paths.length; p++) {
				TreePath path= paths[p];
				if (path.getSegmentCount() > 0 && path.getLastSegment().equals(fElement)) {
					paths[p]= createTreePath(path, newElement);
					changed= true;
				}
			}
			if (changed) {
				newSelection[0]= new TreeSelection(paths, treeSelection.getElementComparer());
			}
		} else {
			Object[] elements= currentSelection.toArray();
			for (int e= 0; e < elements.length; e++) {
				if (elements[e].equals(fElement)) {
					elements[e]= newElement;
					changed= true;
				}
			}
			if (changed) {
				newSelection[0]= new StructuredSelection(elements);
			}
		}
		if (changed) {
			fDisplay.asyncExec(new Runnable() {
				public void run() {
					target.selectReveal(newSelection[0]);
				}
			});
		}
	}
}
 
Example #23
Source File: EditOutputFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public EditOutputFolderAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #24
Source File: BuildpathModifierAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public BuildpathModifierAction(IWorkbenchSite site, ISetSelectionTarget selectionTarget, int id) {
this(site, selectionTarget, id, IAction.AS_PUSH_BUTTON);
  }
 
Example #25
Source File: ResetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ResetAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #26
Source File: CreateLinkedSourceFolderAction2.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public CreateLinkedSourceFolderAction2(HintTextGroup provider, IRunnableContext context, ISetSelectionTarget selectionTarget) {
super(context, selectionTarget);
fProvider= provider;
  }
 
Example #27
Source File: EditFilterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public EditFilterAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #28
Source File: ResetAllOutputFoldersAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ResetAllOutputFoldersAction(IRunnableContext context, IJavaProject project, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context, project);
  }
 
Example #29
Source File: CreateLinkedSourceFolderAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public CreateLinkedSourceFolderAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
 
Example #30
Source File: IncludeToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public IncludeToBuildpathAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }