Java 类org.eclipse.ui.part.ISetSelectionTarget 实例源码

项目:DarwinSPL    文件:DwFeatureModelWizard.java   
protected void selectFileInCurrentView(final IFile file, IWorkbenchPage page) {
    final IWorkbenchPart activePart = page.getActivePart();

    if (activePart instanceof ISetSelectionTarget) {
        final ISelection targetSelection = new StructuredSelection(file);
        Shell shell = getShell();
        Display display = shell.getDisplay();

        Runnable runnable = new Runnable() {
             public void run() {
                 ISetSelectionTarget setSelectionTarget = (ISetSelectionTarget) activePart;
                 setSelectionTarget.selectReveal(targetSelection);
             }
        };

        display.asyncExec(runnable);
    }
}
项目:traceability-assistant-eclipse-plugins    文件:OpenFileWithEditorCommand.java   
/**
 * Run.
 *
 * @param workbench the workbench
 * @param shell the shell
 */
public void run(IWorkbench workbench, Shell shell) {
    // Select the new file resource in the current view
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    final IWorkbenchPart activePart = page.getActivePart();

    // Open an editor on the new file
    try {
        if (activePart instanceof ISetSelectionTarget) {
            final ISelection targetSelection = new StructuredSelection(traceFile);
            shell.getDisplay().asyncExec(new Runnable() {
                public void run() {
                    ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
                }
            });
        }
        page.openEditor(new FileEditorInput(traceFile), workbench.getEditorRegistry().getDefaultEditor(traceFile.getFullPath().toString()).getId());                         
    }
    catch (PartInitException exception) {
        MessageDialog.openError(workbenchWindow.getShell(), "Error opening the editor.", exception.getMessage());
        logger.error("Error opening the editor.",exception);
    }

}
项目:commandline-hero    文件:NewProjectCreationOperation.java   
private void openFile(final IFile file) {
    fDisplay.asyncExec(new Runnable() {
        public void run() {
            IWorkbenchWindow ww = PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow();
            if (ww == null) {
                return;
            }
            IWorkbenchPage page = ww.getActivePage();
            if (page == null || !file.exists())
                return;
            IWorkbenchPart focusPart = page.getActivePart();
            if (focusPart instanceof ISetSelectionTarget) {
                ISelection selection = new StructuredSelection(file);
                ((ISetSelectionTarget) focusPart).selectReveal(selection);
            }
            try {
                page.openEditor(new FileEditorInput(file), EDITOR_ID);
            } catch (PartInitException e) {
            }
        }
    });
}
项目:typescript.java    文件:UIInterpreterHelper.java   
/**
 * 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));
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ShowInNavigatorViewAction.java   
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);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AddArchiveToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:ExcludeFromBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:CreateLinkedSourceFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:CreateSourceFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:BuildpathModifierAction.java   
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));
  }
项目:Eclipse-Postfix-Code-Completion    文件:EditFilterAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:AddSelectedLibraryToBuildpathAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion    文件:AddFolderToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:IncludeToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:ResetAllOutputFoldersAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion    文件:ResetAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion    文件:EditOutputFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:ResetAllAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion    文件:RemoveFromBuildpathAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ShowInNavigatorViewAction.java   
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);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddArchiveToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ExcludeFromBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CreateLinkedSourceFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CreateSourceFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BuildpathModifierAction.java   
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));
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditFilterAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddSelectedLibraryToBuildpathAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:AddFolderToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:IncludeToBuildpathAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ResetAllOutputFoldersAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ResetAction.java   
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);
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditOutputFolderAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ResetAllAction.java   
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);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RemoveFromBuildpathAction.java   
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);
  }
项目:FindBug-for-Domino-Designer    文件:ShowInPackageExplorerAction.java   
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));
    }
}
项目:typescript.java    文件:RenameSelectionState.java   
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]);
                }
            });
        }
    }
}
项目:dita-tools    文件:SourceFileFinderAction.java   
@Override
public void run(IAction action) {

    String textData = getClipboardText();

    if (textData != null) {

        String fileName = null;
        String[] tokens = textData.split("/|\\?");

        for (int t = 0; t < tokens.length; t++) {
            if (tokens[t].matches("([^\\s]+(\\.(?i)(" + filetypes + "))$)")) {
                fileName = tokens[t];
                break;
            }
        }
        if (fileName != null) {

            IFile ff = findFile(fileName);

            if (ff != null) {
                IWorkbenchPage page = DITAToolsPlugin.getDefault()
                        .getWorkbench().getActiveWorkbenchWindow()
                        .getActivePage();

                for (int i = 0; i < navigators.length; i++) {
                    IViewPart view = page.findView(navigators[i]);
                    if (view != null) {
                        ISetSelectionTarget target = (ISetSelectionTarget) view;
                        target.selectReveal(new StructuredSelection(ff));
                    }
                }

            } else {
                createMarker(IMarker.SEVERITY_ERROR,
                        "File not found from clipboard text : " + textData);
            }
        } else {
            createMarker(IMarker.SEVERITY_ERROR,
                    "File not found from clipboard text : " + textData);
        }

    }

}
项目:Eclipse-Postfix-Code-Completion    文件:RenameSelectionState.java   
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]);
                }
            });
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:AddArchiveToBuildpathAction.java   
public AddArchiveToBuildpathAction(IRunnableContext context, ISetSelectionTarget selectionTarget) {
this(null, selectionTarget, context);
  }
项目:Eclipse-Postfix-Code-Completion    文件:CreateSourceFolderAction2.java   
public CreateSourceFolderAction2(HintTextGroup provider, IRunnableContext context, ISetSelectionTarget selectionTarget) {
super(context, selectionTarget);

fProvider= provider;
  }