Java 类org.eclipse.ui.IWorkbenchPart 实例源码

项目:pgcodekeeper    文件:UpdateDdl.java   
@Override
public Object execute(ExecutionEvent event) {
    IWorkbenchPart part = HandlerUtil.getActiveEditor(event);

    if (part instanceof SQLEditor){
        SQLEditor sqlEditor = (SQLEditor) part;

        if (sqlEditor.getCurrentDb() != null) {
            sqlEditor.updateDdl();
        } else {
            MessageBox mb = new MessageBox(HandlerUtil.getActiveShell(event), SWT.ICON_INFORMATION);
            mb.setText(Messages.UpdateDdl_select_source);
            mb.setMessage(Messages.UpdateDdl_select_source_msg);
            mb.open();
        }
    }
    return null;
}
项目:time4sys    文件:GrmEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(GrmEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(GrmEditor.this);
            handleActivate();
        }
    }
    else if (p == GrmEditor.this) {
        handleActivate();
    }
}
项目:gemoc-studio-modeldebugging    文件:TracingannotationsEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(TracingannotationsEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(TracingannotationsEditor.this);
            handleActivate();
        }
    }
    else if (p == TracingannotationsEditor.this) {
        handleActivate();
    }
}
项目:iTrace-Archive    文件:ControlView.java   
/**
 * Recursive function for setting up children controls for a control if it is
 * a composite and setting up the main control's manager.
 * @param part
 * @param control
 */
private void setupControls(IWorkbenchPart part, Control control) {
    //If composite, setup children controls.
    if (control instanceof Composite) {
        Composite composite = (Composite) control;

        Control[] children = composite.getChildren();
        if (children.length > 0 && children[0] != null) {
           for (Control curControl : children)
               setupControls(part, curControl);
        }
    }

    if (control instanceof StyledText) {
        //set up styled text manager if there is one
        setupStyledText((IEditorPart) part, (StyledText) control);

    } else if (control instanceof Browser) {
        //set up browser manager if there is one
        setupBrowser((Browser) control);
    }
    //TODO: no control set up for a ProjectExplorer, since there isn't an need for 
    //a Manager right now, might be needed in the future
}
项目:neoscada    文件:ChartEditor.java   
@Override
public void partActivated ( final IWorkbenchPart p )
{
    if ( p instanceof ContentOutline )
    {
        if ( ( (ContentOutline)p ).getCurrentPage () == ChartEditor.this.contentOutlinePage )
        {
            getActionBarContributor ().setActiveEditor ( ChartEditor.this );

            setCurrentViewer ( ChartEditor.this.contentOutlineViewer );
        }
    }
    else if ( p instanceof PropertySheet )
    {
        if ( ChartEditor.this.propertySheetPages.contains ( ( (PropertySheet)p )
                .getCurrentPage () ) )
        {
            getActionBarContributor ().setActiveEditor ( ChartEditor.this );
            handleActivate ();
        }
    }
    else if ( p == ChartEditor.this )
    {
        handleActivate ();
    }
}
项目:time4sys    文件:SrmEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(SrmEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(SrmEditor.this);
            handleActivate();
        }
    }
    else if (p == SrmEditor.this) {
        handleActivate();
    }
}
项目:neoscada    文件:DeploymentEditor.java   
public void partActivated ( IWorkbenchPart p )
{
    if ( p instanceof ContentOutline )
    {
        if ( ( (ContentOutline)p ).getCurrentPage () == contentOutlinePage )
        {
            getActionBarContributor ().setActiveEditor ( DeploymentEditor.this );

            setCurrentViewer ( contentOutlineViewer );
        }
    }
    else if ( p instanceof PropertySheet )
    {
        if ( propertySheetPages.contains ( ( (PropertySheet)p ).getCurrentPage () ) )
        {
            getActionBarContributor ().setActiveEditor ( DeploymentEditor.this );
            handleActivate ();
        }
    }
    else if ( p == DeploymentEditor.this )
    {
        handleActivate ();
    }
}
项目:neoscada    文件:ProfileEditor.java   
public void partActivated ( IWorkbenchPart p )
{
    if ( p instanceof ContentOutline )
    {
        if ( ( (ContentOutline)p ).getCurrentPage () == contentOutlinePage )
        {
            getActionBarContributor ().setActiveEditor ( ProfileEditor.this );

            setCurrentViewer ( contentOutlineViewer );
        }
    }
    else if ( p instanceof PropertySheet )
    {
        if ( propertySheetPages.contains ( ( (PropertySheet)p ).getCurrentPage () ) )
        {
            getActionBarContributor ().setActiveEditor ( ProfileEditor.this );
            handleActivate ();
        }
    }
    else if ( p == ProfileEditor.this )
    {
        handleActivate ();
    }
}
项目:neoscada    文件:ItemEditor.java   
public void partActivated ( IWorkbenchPart p )
{
    if ( p instanceof ContentOutline )
    {
        if ( ( (ContentOutline)p ).getCurrentPage () == contentOutlinePage )
        {
            getActionBarContributor ().setActiveEditor ( ItemEditor.this );

            setCurrentViewer ( contentOutlineViewer );
        }
    }
    else if ( p instanceof PropertySheet )
    {
        if ( propertySheetPages.contains ( ( (PropertySheet)p ).getCurrentPage () ) )
        {
            getActionBarContributor ().setActiveEditor ( ItemEditor.this );
            handleActivate ();
        }
    }
    else if ( p == ItemEditor.this )
    {
        handleActivate ();
    }
}
项目:time4sys    文件:GqamEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(GqamEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(GqamEditor.this);
            handleActivate();
        }
    }
    else if (p == GqamEditor.this) {
        handleActivate();
    }
}
项目:gw4e.project    文件:GW4EEditor.java   
protected void createActions() {
    super.createActions();
    ActionRegistry registry = getActionRegistry();

    IAction action = new DirectEditAction((IWorkbenchPart) this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new CopyNodeAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new PasteNodeAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new ClearEdgeBendpointLayoutAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());


}
项目:time4sys    文件:HrmEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(HrmEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(HrmEditor.this);
            handleActivate();
        }
    }
    else if (p == HrmEditor.this) {
        handleActivate();
    }
}
项目:time4sys    文件:LibraryEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(LibraryEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(LibraryEditor.this);
            handleActivate();
        }
    }
    else if (p == LibraryEditor.this) {
        handleActivate();
    }
}
项目:time4sys    文件:NfpEditor.java   
public void partActivated(IWorkbenchPart p) {
    if (p instanceof ContentOutline) {
        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
            getActionBarContributor().setActiveEditor(NfpEditor.this);

            setCurrentViewer(contentOutlineViewer);
        }
    }
    else if (p instanceof PropertySheet) {
        if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) {
            getActionBarContributor().setActiveEditor(NfpEditor.this);
            handleActivate();
        }
    }
    else if (p == NfpEditor.this) {
        handleActivate();
    }
}
项目:neoscada    文件:GlobalizeEditor.java   
public void partActivated ( IWorkbenchPart p )
{
    if ( p instanceof ContentOutline )
    {
        if ( ( (ContentOutline)p ).getCurrentPage () == contentOutlinePage )
        {
            getActionBarContributor ().setActiveEditor ( GlobalizeEditor.this );

            setCurrentViewer ( contentOutlineViewer );
        }
    }
    else if ( p instanceof PropertySheet )
    {
        if ( propertySheetPages.contains ( ( (PropertySheet)p ).getCurrentPage () ) )
        {
            getActionBarContributor ().setActiveEditor ( GlobalizeEditor.this );
            handleActivate ();
        }
    }
    else if ( p == GlobalizeEditor.this )
    {
        handleActivate ();
    }
}
项目:ide-plugins    文件:InsertFunctionTester.java   
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if ("gluonMobileFound".equals(property)) {
        try {
            IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWorkbenchWindow == null) {
                return false;
            }
            IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
            if (activePage == null) {
                return false;
            }
            IWorkbenchPart activePart = activePage.getActivePart();
            if (activePart == null || ! (activePart instanceof CompilationUnitEditor)) {
                return false;
            }
            IEditorPart editor = activePage.getActiveEditor();
            if (editor == null) {
                return false;
            }
            IEditorInput input = editor.getEditorInput();
            if (input == null || ! (input instanceof FileEditorInput)) {
                return false;
            }
            IFile file = ((FileEditorInput) input).getFile();
            if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) {
                ProjectUtils utils = new ProjectUtils(file.getProject());
            return utils.isGluonMobileProject();
            }
        } catch (Exception e) { }
    }
    return false;
}
项目:pgcodekeeper    文件:DiffProject.java   
@Override
public Object execute(ExecutionEvent event) {
    IWorkbenchPart part = HandlerUtil.getActiveEditor(event);

    if (part instanceof ProjectEditorDiffer){
        ProjectEditorDiffer differ = (ProjectEditorDiffer) part;
        differ.diff();
    }
    return null;
}
项目:gemoc-studio-modeldebugging    文件:StateGraphLayoutConnector.java   
@Override
public LayoutMapping buildLayoutGraph(IWorkbenchPart workbenchPart, Object diagramPart) {

    StateGraphViewPart layoutRootPart = null;

    if (!(workbenchPart instanceof StateGraphViewPart)) {
        return null;
    }

    layoutRootPart = (StateGraphViewPart) workbenchPart;
    final StateGraph stateGraph = layoutRootPart.getStateGraph();
    LayoutMapping mapping = new LayoutMapping(workbenchPart);
    mapping.setParentElement(layoutRootPart);

    KNode topNode = ElkUtil.createInitializedNode();
    mapping.getGraphMap().put(topNode, layoutRootPart);
    mapping.setLayoutGraph(topNode);

    final Set<StateVertex> movedVertice = layoutRootPart.getMovedVertice();

    final List<StateVertex> vertice = new ArrayList<>(stateGraph.getVertice());
    vertice.removeAll(movedVertice);

    for (StateVertex vertex : vertice) {
        KNode node = createNode(mapping, vertex, topNode);
        mapping.getGraphMap().put(node, vertex);
    }

    List<DirectedGraph.Edge<StateVertex>> edges = stateGraph.getEdges().stream()
            .filter(e -> !movedVertice.contains(e.getSource()) && !movedVertice.contains(e.getTarget()))
            .collect(Collectors.toList());

    for (DirectedGraph.Edge<StateVertex> edge : edges) {
        KEdge kEdge = createEdge(mapping, edge);
        mapping.getGraphMap().put(kEdge, edge);
    }

    return mapping;
}
项目:Hydrograph    文件:CutHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    if(part instanceof ELTGraphicalEditor){
        copy.execute(event);
        cut.execute(event);
    }
    return null;
}
项目:Equella    文件:NewPluginWizard.java   
private IWorkbenchPart getActivePart()
{
    IWorkbenchWindow activeWindow = getWorkbench().getActiveWorkbenchWindow();
    if( activeWindow != null )
    {
        IWorkbenchPage activePage = activeWindow.getActivePage();
        if( activePage != null )
        {
            return activePage.getActivePart();
        }
    }
    return null;
}
项目:neoscada    文件:AbstractChartManagePart.java   
protected void attachSelectionService ()
{
    getViewSite ().getWorkbenchWindow ().getSelectionService ().addPostSelectionListener ( new ISelectionListener () {

        @Override
        public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
        {
            handleSelectionChanged ( selection );
        }

    } );
    handleSelectionChanged ( getViewSite ().getWorkbenchWindow ().getSelectionService ().getSelection () );
}
项目:neoscada    文件:AbstractQueryViewPart.java   
protected void addSelectionListener ()
{
    if ( this.selectionListener == null )
    {
        getViewSite ().getWorkbenchWindow ().getSelectionService ().addSelectionListener ( this.selectionListener = new ISelectionListener () {

            public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
            {
                AbstractQueryViewPart.this.setSelection ( selection );
            }
        } );
    }
}
项目:gw4e.project    文件:CustomProperties.java   
public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    Object input = ((IStructuredSelection) selection).getFirstElement();
    this.node = (SectionProvider) input;
    GWNode model = this.node.getModel();
    Map<String, Object> p = model.getProperties();
    this.properties = ModelProperties.filterCustomProperty(p);
    listViewer.setInput(this.properties.entrySet());
}
项目:neoscada    文件:AbstractAlarmsEventsView.java   
protected void addSelectionListener ()
{
    if ( this.selectionListener == null )
    {
        getViewSite ().getWorkbenchWindow ().getSelectionService ().addSelectionListener ( this.selectionListener = new ISelectionListener () {

            @Override
            public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
            {
                AbstractAlarmsEventsView.this.setSelection ( selection );
            }
        } );
    }
}
项目:neoscada    文件:AcknowledgeHandler.java   
@Override
public Object execute ( final ExecutionEvent handlerEvent ) throws ExecutionException
{
    final IWorkbenchPart part = getActivePage ().getActivePart ();
    if ( ! ( part instanceof MonitorSubscriptionAlarmsEventsView ) )
    {
        return null;
    }

    final MonitorSubscriptionAlarmsEventsView view = (MonitorSubscriptionAlarmsEventsView)part;

    final Iterator<?> i = getSelection ().iterator ();

    while ( i.hasNext () )
    {
        final AckInformation ackInformation = AdapterHelper.adapt ( i.next (), AckInformation.class );
        if ( ackInformation == null )
        {
            continue;
        }

        final MonitorStatus status = ackInformation.getMonitorStatus ();
        switch ( status )
        {
            case NOT_AKN:
            case NOT_OK_NOT_AKN:
                view.acknowledgeMonitor ( ackInformation.getMonitorId (), ackInformation.getTimestamp (), new DisplayCallbackHandler ( getShell (), "Acknowledge", "Confirmation required" ) );
                break;
            default:
                break;
        }
    }

    return null;
}
项目:neoscada    文件:QueryViewPart.java   
/**
 * Add a listener to the global selection service and set the currently selected query
 */
protected void addListener ()
{
    if ( this.selectionListener == null )
    {
        getViewSite ().getWorkbenchWindow ().getSelectionService ().addSelectionListener ( this.selectionListener = new ISelectionListener () {

            @Override
            public void selectionChanged ( final IWorkbenchPart part, final ISelection selection )
            {
                QueryViewPart.this.setSelection ( selection );
            }
        } );
    }
}
项目:pgcodekeeper    文件:SQLEditor.java   
@Override
public void resourceChanged(IResourceChangeEvent event) {
    IResource file = ResourceUtil.getResource(getEditorInput());
    IResourceDelta delta = event.getDelta();
    if (delta != null && file != null) {
        IResourceDelta child = delta.findMember(file.getFullPath());
        if (child != null && (child.getFlags() & IResourceDelta.MARKERS) != 0) {
            UiSync.exec(parentComposite, () -> {
                if (!parentComposite.isDisposed()) {
                    firePropertyChange(IWorkbenchPart.PROP_TITLE);
                }
            });
        }
    }
}
项目:convertigo-eclipse    文件:StepExportVariablesToSequenceAction.java   
public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);       

    Shell shell = getParentShell();
    shell.setCursor(waitCursor);

       try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            Object databaseObject = treeObject.getObject();
            if ((databaseObject != null) && (databaseObject instanceof RequestableStep)) {
                RequestableStep requestableStep = (RequestableStep)databaseObject;
                requestableStep.exportVariableDefinition();

                Sequence sequence = requestableStep.getSequence();
                if (sequence.hasChanged) {
                    SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(sequence);
                    explorerView.reloadTreeObject(sequenceTreeObject);
                    explorerView.setSelectedTreeObject(sequenceTreeObject);
                    StructuredSelection structuredSelection = new StructuredSelection(sequenceTreeObject);
                    ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart)explorerView, structuredSelection);
                }
            }
        }
       }
       catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to export step variables to main sequence!");
       }
       finally {
        shell.setCursor(null);
        waitCursor.dispose();
       }
}
项目:scanning    文件:ValidateResultsView.java   
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    if (selection instanceof IStructuredSelection) {
        Object ob = ((IStructuredSelection)selection).getFirstElement();

        if (ob instanceof ValidateResults) {
            ValidateResults validationResults  = (ValidateResults)ob;
            update(validationResults);
        }

    }
}
项目:gw4e.project    文件:VertexInitSection.java   
public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    Object input = ((IStructuredSelection) selection).getFirstElement();
    this.node = (SectionProvider) input;
    AbstractGW4EEditPartProperties properties = (AbstractGW4EEditPartProperties) node.getAdapter(IPropertySource.class);
    viewer.getControl().setEnabled(properties.isUpdatable(ModelProperties.PROPERTY_VERTEX_INIT));
}
项目:n4js    文件:AbstractOutlineWorkbenchTest.java   
protected void activate(IWorkbenchPart part) {
    editor.getSite().getPage().activate(part);
}
项目:OCCI-Studio    文件:CrtpEditor.java   
public void partDeactivated(IWorkbenchPart p) {
    // Ignore.
}
项目:Hydrograph    文件:WatchRecordAction.java   
public WatchRecordAction(IWorkbenchPart part) {
    super(part);
    setLazyEnablementCalculation(true);
}
项目:gemoc-studio    文件:GexpressionsEditor.java   
public void partClosed(IWorkbenchPart p) {
    // Ignore.
}
项目:smarthome-cep-demonstrator    文件:SmarthomeEditor.java   
public void partClosed(IWorkbenchPart p) {
    // Ignore.
}
项目:smarthome-cep-demonstrator    文件:SmarthomeEditor.java   
public void partDeactivated(IWorkbenchPart p) {
    // Ignore.
}
项目:SimQRI    文件:MetamodelEditor.java   
public void partBroughtToTop(IWorkbenchPart p) {
    // Ignore.
}
项目:time4sys    文件:Time4sysEditor.java   
public void partBroughtToTop(IWorkbenchPart p) {
    // Ignore.
}
项目:SimQRI    文件:MetamodelEditor.java   
public void partDeactivated(IWorkbenchPart p) {
    // Ignore.
}
项目:SimQRI    文件:MetamodelEditor.java   
public void partOpened(IWorkbenchPart p) {
    // Ignore.
}