Java 类org.eclipse.jface.viewers.IStructuredSelection 实例源码

项目:neoscada    文件:AbstractQueryHandler.java   
protected Collection<QueryBean> getQueryList ()
{
    final IStructuredSelection sel = getSelection ();

    if ( sel == null )
    {
        return Collections.emptyList ();

    }

    final Collection<QueryBean> result = new LinkedList<QueryBean> ();
    final Iterator<?> i = sel.iterator ();
    while ( i.hasNext () )
    {
        final Object o = i.next ();
        if ( o instanceof QueryBean )
        {
            result.add ( (QueryBean)o );
        }
    }

    return result;
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addRServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(rServices.getInput(), rServicesFilters, rServicesBusinessFilters,
    "rServices", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(OtherPropertiesEditionPartImpl.this, LibraryViewsRepository.Other.Properties.rServices,
                    PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            rServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addExitServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(exitServices.getInput(),
            exitServicesFilters, exitServicesBusinessFilters, "exitServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.exitServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            exitServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addDelayServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(delayServices.getInput(),
            delayServicesFilters, delayServicesBusinessFilters, "delayServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.delayServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            delayServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addRServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(rServices.getInput(), rServicesFilters, rServicesBusinessFilters,
    "rServices", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(OtherPropertiesEditionPartImpl.this, GrmViewsRepository.Other.OtherProperties.rServices,
                    PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            rServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addReceiveServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(receiveServices.getInput(),
            receiveServicesFilters, receiveServicesBusinessFilters, "receiveServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.receiveServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            receiveServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:TimingPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addMutualExclusionResources() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(mutualExclusionResources.getInput(),
            mutualExclusionResourcesFilters, mutualExclusionResourcesBusinessFilters, "mutualExclusionResources",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent
                        .firePropertiesChanged(new PropertiesEditionEvent(TimingPropertiesEditionPartForm.this,
                                SrmViewsRepository.Timing.Properties.mutualExclusionResources,
                                PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            mutualExclusionResources.refresh();
        }
    };
    dialog.open();
}
项目:neoscada    文件:AbstractChartManagePart.java   
protected void handleSelectionChanged ( final ISelection sel )
{
    if ( sel == null || sel.isEmpty () )
    {
        return;
    }
    if ( ! ( sel instanceof IStructuredSelection ) )
    {
        return;
    }

    final Object o = ( (IStructuredSelection)sel ).getFirstElement ();
    if ( ! ( o instanceof ChartViewer ) )
    {
        return;
    }

    setChartViewer ( (ChartViewer)o );
}
项目:time4sys    文件:OtherPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addClearServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(clearServices.getInput(),
            clearServicesFilters, clearServicesBusinessFilters, "clearServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.clearServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            clearServices.refresh();
        }
    };
    dialog.open();
}
项目:n4js    文件:N4JSResourceLinkHelper.java   
@Override
public void activateEditor(final IWorkbenchPage page, final IStructuredSelection selection) {
    if (null != selection && !selection.isEmpty()) {
        final Object firstElement = selection.getFirstElement();
        if (firstElement instanceof ResourceNode) {
            final File fileResource = ((ResourceNode) firstElement).getResource();
            if (fileResource.exists() && fileResource.isFile()) {
                final URI uri = URI.createFileURI(fileResource.getAbsolutePath());
                final IResource resource = externalLibraryWorkspace.getResource(uri);
                if (resource instanceof IFile) {
                    final IEditorInput editorInput = EditorUtils.createEditorInput(new URIBasedStorage(uri));
                    final IEditorPart editor = page.findEditor(editorInput);
                    if (null != editor) {
                        page.bringToTop(editor);
                        return;
                    }
                }
            }
        }
    }
    super.activateEditor(page, selection);
}
项目:convertigo-eclipse    文件:CreateDocumentAction.java   
public void selectionChanged(IAction action, ISelection selection) {
    try {
        boolean enable = true;
        super.selectionChanged(action, selection);
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
        if (treeObject instanceof ObjectsFolderTreeObject)
            enable = ((ObjectsFolderTreeObject)treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_DOCUMENTS;
        else if (treeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
            ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
            enable = actionModel.isEnabled;
        }
        action.setEnabled(enable);
    }
    catch (Exception e) {}
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addReleaseServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(releaseServices.getInput(),
            releaseServicesFilters, releaseServicesBusinessFilters, "releaseServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.releaseServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            releaseServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addRoutineConnectServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(routineConnectServices.getInput(),
            routineConnectServicesFilters, routineConnectServicesBusinessFilters, "routineConnectServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent
                        .firePropertiesChanged(new PropertiesEditionEvent(OtherPropertiesEditionPartImpl.this,
                                SrmViewsRepository.Other.Properties.routineConnectServices,
                                PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            routineConnectServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addOpenServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(openServices.getInput(),
            openServicesFilters, openServicesBusinessFilters, "openServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.openServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            openServices.refresh();
        }
    };
    dialog.open();
}
项目:avro-schema-editor    文件:SchemaRegistryView.java   
protected void updateToolbarOnSelectionChanged(ISelection selection) {
    IStructuredSelection sel = (IStructuredSelection) selection;
    NSNode selectedNode = null;
    if (sel.isEmpty()) {
        selectedNode = schemaRegistry.getNameSpaceTree();
    } else {
        Object element = sel.getFirstElement();
        if (element instanceof NSNode) {
            selectedNode = (NSNode) element;
        }
    }       
    for (NameSpaceAction action : actions) {
        action.setNSNode(selectedNode);             
    }
    toolbarMgr.update(true);
}
项目:eclipse-bash-editor    文件:BashEditor.java   
public void openSelectedTreeItemInEditor(ISelection selection, boolean grabFocus) {
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        Object firstElement = ss.getFirstElement();
        if (firstElement instanceof Item) {
            Item item = (Item) firstElement;
            int offset = item.getOffset();
            int length = item.getLength();
            if (length == 0) {
                /* fall back */
                length = 1;
            }
            ignoreNextCaretMove = true;
            selectAndReveal(offset, length);
            if (grabFocus) {
                setFocus();
            }
        }
    }
}
项目:time4sys    文件:GeneralPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addUsedResource() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(usedResource.getInput(),
            usedResourceFilters, usedResourceBusinessFilters, "usedResource",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        GeneralPropertiesEditionPartImpl.this, GrmViewsRepository.General.Properties.usedResource,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            usedResource.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:TimingPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addTimers() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(timers.getInput(), timersFilters,
            timersBusinessFilters, "timers", propertiesEditionComponent.getEditingContext().getAdapterFactory(),
            current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        TimingPropertiesEditionPartImpl.this, SrmViewsRepository.Timing.Properties.timers,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            timers.refresh();
        }
    };
    dialog.open();
}
项目:pgsqlblocks    文件:ProcessesController.java   
private void dbBlocksJournalViewSelectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (selection.isEmpty()) {
        dbBlocksJournalProcessInfoView.hide();
    } else {
        DBProcess process;
        IStructuredSelection structuredSelection = (IStructuredSelection)selection;
        Object element = structuredSelection.getFirstElement();
        if (element instanceof DBBlocksJournalProcess) {
            DBBlocksJournalProcess blocksJournalProcess = (DBBlocksJournalProcess)element;
            process = blocksJournalProcess.getProcess();
        } else {
            process = (DBProcess)element;
        }
        dbBlocksJournalProcessInfoView.show(process);
    }
}
项目:neoscada    文件:ItemDragSourceListener.java   
@Override
public void dragStart ( final DragSourceEvent event )
{
    event.doit = false;

    if ( ! ( this.viewer.getSelection () instanceof IStructuredSelection ) )
    {
        return;
    }

    final Collection<Item> items = ItemSelectionHelper.getSelection ( this.viewer.getSelection () );
    if ( !items.isEmpty () )
    {
        LocalSelectionTransfer.getTransfer ().setSelection ( this.viewer.getSelection () );
        event.doit = true;
    }

}
项目:time4sys    文件:OtherPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addReleaseServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(releaseServices.getInput(),
            releaseServicesFilters, releaseServicesBusinessFilters, "releaseServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.releaseServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            releaseServices.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addUnmapServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(unmapServices.getInput(),
            unmapServicesFilters, unmapServicesBusinessFilters, "unmapServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartForm.this, SrmViewsRepository.Other.Properties.unmapServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            unmapServices.refresh();
        }
    };
    dialog.open();
}
项目:SimQRI    文件:ConveyorBeltPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addStorageOutputFlow() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(storageOutputFlow.getInput(), storageOutputFlowFilters, storageOutputFlowBusinessFilters,
    "storageOutputFlow", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ConveyorBeltPropertiesEditionPartForm.this, MetamodelViewsRepository.ConveyorBelt.Properties.storageOutputFlow,
                    PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            storageOutputFlow.refresh();
        }
    };
    dialog.open();
}
项目:SimQRI    文件:BatchProcessPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addStorageOutputFlow() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(storageOutputFlow.getInput(), storageOutputFlowFilters, storageOutputFlowBusinessFilters,
    "storageOutputFlow", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(BatchProcessPropertiesEditionPartForm.this, MetamodelViewsRepository.BatchProcess.Properties.storageOutputFlow,
                    PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            storageOutputFlow.refresh();
        }
    };
    dialog.open();
}
项目:neoscada    文件:ItemDragSourceListener.java   
@Override
public void dragSetData ( final DragSourceEvent event )
{
    try
    {
        if ( ItemTransfer.getInstance ().isSupportedType ( event.dataType ) )
        {
            final IStructuredSelection selection = (IStructuredSelection)LocalSelectionTransfer.getTransfer ().getSelection ();
            final Collection<Item> items = ItemSelectionHelper.getSelection ( selection );
            event.data = items.toArray ( new Item[items.size ()] );
            event.doit = true;
        }
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to set drag data", e );
        event.doit = false;
    }

}
项目:SimQRI    文件:SupplierPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addRefillPolicy() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(refillPolicy.getInput(), refillPolicyFilters, refillPolicyBusinessFilters,
    "refillPolicy", propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(SupplierPropertiesEditionPartImpl.this, MetamodelViewsRepository.Supplier.Properties.refillPolicy,
                    PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            refillPolicy.refresh();
        }
    };
    dialog.open();
}
项目:convertigo-eclipse    文件:DeleteDesignDocumentFunctionAction.java   
public void selectionChanged(IAction action, ISelection selection) {
    super.selectionChanged(action, selection);
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
    if (treeObject instanceof DesignDocumentFunctionTreeObject) {
        DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject)treeObject;
        // filter function
        if (treeObject instanceof DesignDocumentFilterTreeObject) {
            action.setEnabled(true);
        }
        // update function
        else if (treeObject instanceof DesignDocumentUpdateTreeObject) {
            action.setEnabled(true);
        }
        // view function
        else {
            action.setEnabled(ddfto.getName().equals(CouchKey.reduce.key()));
        }
    }
}
项目:time4sys    文件:TimingPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addAccessTokenElements() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(accessTokenElements.getInput(),
            accessTokenElementsFilters, accessTokenElementsBusinessFilters, "accessTokenElements",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent
                        .firePropertiesChanged(new PropertiesEditionEvent(TimingPropertiesEditionPartForm.this,
                                SrmViewsRepository.Timing.Properties.accessTokenElements,
                                PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            accessTokenElements.refresh();
        }
    };
    dialog.open();
}
项目:eZooKeeper    文件:BaseAction.java   
public boolean canRun() {

        InputType inputType = getInputType();

        if (inputType.isStructuredSelection()) {
            IStructuredSelection structuredSelection = getCurrentStructuredSelection();
            if (canRunWithStructuredSelection(structuredSelection)) {
                return true;
            }
        }
        else if (inputType.isEditorInput()) {

            IEditorPart editor = getActiveEditor();
            IEditorInput editorInput = (editor != null) ? editor.getEditorInput() : null;

            if (canRunWithEditorInput(editorInput)) {
                return true;
            }
        }
        else if (canRunWithNothing()) {
            return true;
        }

        return false;

    }
项目:time4sys    文件:GeneralPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addEndToEndStimuli() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(endToEndStimuli.getInput(),
            endToEndStimuliFilters, endToEndStimuliBusinessFilters, "endToEndStimuli",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent
                        .firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartForm.this,
                                GqamViewsRepository.General.Properties.endToEndStimuli,
                                PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            endToEndStimuli.refresh();
        }
    };
    dialog.open();
}
项目:bdf2    文件:SelectClassPage.java   
/**
 * 当用户通过右键菜单启动向导时,初始化类选择列表
 * @param selection 当前选择项
 */
public void init(IStructuredSelection selection) {
    IJavaProject jProject = ProjectHelper.getCurrentJavaProject();
    if (jProject == null) {
        alertAndClose();
        return;
    }

    Map<String, List<String>> packageClassMap = new HashMap<String, List<String>>();
    setPackageClassMap(selection, packageClassMap);

    for(String packageName : packageClassMap.keySet()){
        List<String> classes = packageClassMap.get(packageName);
        if(classes.isEmpty()){
            nodeListManager.addNodesFromPackage(jProject, packageName, getFile(jProject, packageName).list());
        }else{
            nodeListManager.addNodesFromPackage(jProject, packageName, classes.toArray(new String[classes.size()]));
        }
    }
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addForkServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(forkServices.getInput(),
            forkServicesFilters, forkServicesBusinessFilters, "forkServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.forkServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            forkServices.refresh();
        }
    };
    dialog.open();
}
项目:gemoc-studio-modeldebugging    文件:GemocToggleBreakpointHandler.java   
@Override
public boolean isEnabled() {
    final boolean res;

    ISelectionService service = (ISelectionService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ISelectionService.class);
    if (service != null) {
        final ISelection selection = service.getSelection();
        if (selection instanceof IStructuredSelection) {
            boolean allValidMSE = true;
            final Iterator<?> it = ((IStructuredSelection) selection).iterator();
            while (allValidMSE && it.hasNext()) {
                Object current = it.next();
                allValidMSE = current instanceof MSE /*&& ((MSE) current).getAction() != null*/;
            }
            res = allValidMSE;
        } else {
            res = false;
        }
    } else {
        res = false;
    }

    return res;
}
项目:time4sys    文件:GeneralPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addCause() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(cause.getInput(), causeFilters,
            causeBusinessFilters, "cause", propertiesEditionComponent.getEditingContext().getAdapterFactory(),
            current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        GeneralPropertiesEditionPartImpl.this, GqamViewsRepository.General.Properties.cause,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            cause.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:GeneralPropertiesEditionPartForm.java   
/**
 * 
 */
protected void addSchedulableResource() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(schedulableResource.getInput(),
            schedulableResourceFilters, schedulableResourceBusinessFilters, "schedulableResource",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent
                        .firePropertiesChanged(new PropertiesEditionEvent(GeneralPropertiesEditionPartForm.this,
                                GrmViewsRepository.General.Properties.schedulableResource,
                                PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            schedulableResource.refresh();
        }
    };
    dialog.open();
}
项目:time4sys    文件:OtherPropertiesEditionPartImpl.java   
/**
 * 
 */
protected void addUnlockServices() {
    TabElementTreeSelectionDialog dialog = new TabElementTreeSelectionDialog(unlockServices.getInput(),
            unlockServicesFilters, unlockServicesBusinessFilters, "unlockServices",
            propertiesEditionComponent.getEditingContext().getAdapterFactory(), current.eResource()) {
        @Override
        public void process(IStructuredSelection selection) {
            for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
                EObject elem = (EObject) iter.next();
                propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(
                        OtherPropertiesEditionPartImpl.this, SrmViewsRepository.Other.Properties.unlockServices,
                        PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.ADD, null, elem));
            }
            unlockServices.refresh();
        }
    };
    dialog.open();
}
项目:n4js    文件:LaunchXpectShortcut.java   
@Override
public void launch(ISelection selection, String mode) {
    try {
        Object selectObj = ((IStructuredSelection) selection).getFirstElement();
        if (selectObj instanceof IFile) {
            launchFile((IFile) selectObj, mode);
        } else {
            showDialogNotImplemented(selection.getClass().getName());
        }
    } catch (CoreException e) {
        System.out.println(e.getLocalizedMessage() + "\n");
    }
}
项目:neoscada    文件:SecurityModelWizard.java   
/**
 * This just records the information.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void init ( IWorkbench workbench, IStructuredSelection selection )
{
    this.workbench = workbench;
    this.selection = selection;
    setWindowTitle ( SecurityEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$
    setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( SecurityEditorPlugin.INSTANCE.getImage ( "full/wizban/NewSecurity" ) ) ); //$NON-NLS-1$
}
项目:n4js    文件:OpenGeneratedSourceInEditorHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {

    final ISelection selection = getCurrentSelection(event);
    if (null == selection) {
        return null;
    }

    if (selection.isEmpty()) {
        return null;
    }

    final AtomicReference<IFile> fileRef = new AtomicReference<>();

    if (selection instanceof IStructuredSelection) {
        final Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element instanceof IFile) {
            fileRef.set((IFile) element);
        }
    } else if (selection instanceof ITextSelection) {
        final IEditorPart editorPart = getActiveEditor(event);
        if (null != editorPart) {
            final IEditorInput input = editorPart.getEditorInput();
            if (input instanceof IFileEditorInput) {
                fileRef.set(((IFileEditorInput) input).getFile());
            }
        }
    }

    if (null != fileRef.get()) {
        final Optional<IFile> generatedSource = fileLocator.tryGetGeneratedSourceForN4jsFile(fileRef.get());
        if (generatedSource.isPresent()) {
            tryOpenFileInEditor(fileRef.get(), generatedSource.get());
        }
    }

    return null;
}
项目:neoscada    文件:RecipeEditor.java   
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setStatusLineManager ( ISelection selection )
{
    IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager : getActionBars ().getStatusLineManager ();

    if ( statusLineManager != null )
    {
        if ( selection instanceof IStructuredSelection )
        {
            Collection<?> collection = ( (IStructuredSelection)selection ).toList ();
            switch ( collection.size () )
            {
                case 0:
                {
                    statusLineManager.setMessage ( getString ( "_UI_NoObjectSelected" ) ); //$NON-NLS-1$
                    break;
                }
                case 1:
                {
                    String text = new AdapterFactoryItemDelegator ( adapterFactory ).getText ( collection.iterator ().next () );
                    statusLineManager.setMessage ( getString ( "_UI_SingleObjectSelected", text ) ); //$NON-NLS-1$
                    break;
                }
                default:
                {
                    statusLineManager.setMessage ( getString ( "_UI_MultiObjectSelected", Integer.toString ( collection.size () ) ) ); //$NON-NLS-1$
                    break;
                }
            }
        }
        else
        {
            statusLineManager.setMessage ( "" ); //$NON-NLS-1$
        }
    }
}