本文整理匯總了Java中org.eclipse.gef.EditPart類的典型用法代碼示例。如果您正苦於以下問題:Java EditPart類的具體用法?Java EditPart怎麽用?Java EditPart使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EditPart類屬於org.eclipse.gef包,在下文中一共展示了EditPart類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createEditPart
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public EditPart createEditPart(EditPart context, Object model) {
if (model instanceof DeploymentNode)
return new DeploymentEditPart((DeploymentNode) model, containerName);
else if (model instanceof PlatformConfigurationNode)
return new PlatformConfigurationEditPart((PlatformConfigurationNode) model, containerName);
else if (model instanceof ComputingNodeConfigurationNode)
return new ComputingNodeConfigurationEditPart((ComputingNodeConfigurationNode) model, containerName);
else if (model instanceof ProtectionDomainNode)
return new ProtectionDomainEditPart((ProtectionDomainNode) model, containerName);
else if (model instanceof DeployedModuleInstanceNode)
return new DeployedModuleInstanceEditPart((DeployedModuleInstanceNode) model, containerName);
else if (model instanceof DeployedTriggerInstanceNode)
return new DeployedTriggerInstanceEditPart((DeployedTriggerInstanceNode) model, containerName);
return null;
}
示例2: createEditPart
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public EditPart createEditPart(EditPart context, Object model) {
if (model instanceof CompositeNode)
return new CompositeEditPart((CompositeNode) model, containerName);
else if (model instanceof CompositePropertyNode)
return new CompositePropertyEditPart((CompositePropertyNode) model, containerName);
else if (model instanceof ComponentNode)
return new ComponentEditPart((ComponentNode) model, containerName);
else if (model instanceof ComponentPropertyNode)
return new ComponentPropertyEditPart((ComponentPropertyNode) model, containerName);
else if (model instanceof ServiceNode)
return new ServiceEditPart((ServiceNode) model, containerName);
else if (model instanceof ReferenceNode)
return new ReferenceEditPart((ReferenceNode) model, containerName);
else if (model instanceof Link)
return new LinkEditPart((Link) model, containerName);
return null;
}
示例3: createCopyCommand
import org.eclipse.gef.EditPart; //導入依賴的package包/類
private Command createCopyCommand(List<Object> selectedObjects) {
if (selectedObjects == null || selectedObjects.isEmpty()) {
return null;
}
CopyNodeCommand cmd = new CopyNodeCommand();
Iterator<Object> it = selectedObjects.iterator();
while (it.hasNext()) {
Object obj = it.next();
if (!(obj instanceof EditPart)) continue;
EditPart ep = (EditPart) obj;
if (!(ep.getModel() instanceof GWNode)) continue;
GWNode gWNode = (GWNode) ep.getModel();
if (!cmd.isCopyableNode(gWNode))
return null;
cmd.addElement(ep);
}
return cmd;
}
示例4: createEditPart
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public EditPart createEditPart(EditPart context, Object model) {
AbstractGraphicalEditPart part = null;
if (model instanceof GWGraph) {
part = gpart;
} else {
if (model instanceof SharedVertex) {
part = new SharedVertexPart();
} else if (model instanceof StartVertex) {
part = new StartVertexPart();
} else if (model instanceof Vertex) {
part = new VertexPart();
} else {
if (model instanceof GWEdge) {
part = new EdgePart();
}
}
}
if (part==null) {
throw new RuntimeException (" UnManaged Model " + model.getClass().getName());
}
part.setModel(model);
return part;
}
示例5: getAdapter
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public Object getAdapter(Class adapter) {
EditPart ep = this;
if (adapter == IFile.class) {
while (ep!=null && !(ep instanceof GraphPart)) {
ep = ep.getParent();
}
if (ep!=null) {
GraphPart gp = (GraphPart) ep;
GWGraph model = (GWGraph)gp.getModel();
return model.getFile();
}
return null;
}
return null;
}
示例6: performCreation
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override protected void performCreation(int button) {
super.performCreation(button);
EditPartViewer viewer = getCurrentViewer();
final Object model = getCreateRequest().getNewObject();
if (model == null || viewer == null) {
return;
}
final Object o = getCurrentViewer().getEditPartRegistry().get(model);
if(o instanceof EditPart) {
Display.getCurrent().asyncExec(new Runnable() {
@Override public void run() {
EditPart part = (EditPart)o;
Request request = new DirectEditRequest();
part.performRequest(request);
}
});
}
}
示例7: getGraph
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* @return the graph
*/
public GWGraph getGraph() {
if (graph==null) {
List<SWTBotGefEditPart> parts = editor.editParts(new BaseMatcher<EditPart>() {
@Override
public boolean matches(Object item) {
if (item instanceof org.gw4e.eclipse.studio.part.editor.GraphPart) return true;
if (item instanceof org.gw4e.eclipse.studio.part.editor.VertexPart) return true;
if (item instanceof org.gw4e.eclipse.studio.part.editor.EdgePart) return true;
return false;
}
@Override
public void describeTo(Description description) {
}
});
if (parts==null || parts.size() ==0) {
throw new RuntimeException("Empty Graph");
}
graph = getGraph (parts.get(0));
}
return graph;
}
示例8: deepRefresh
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* Refresh {@link EditPart} in depth.
*/
private void deepRefresh() {
refresh();
for (Branch branch : getModelChildren()) {
final EditPart branchEditPart = (EditPart)getViewer().getEditPartRegistry().get(branch);
branchEditPart.refresh();
for (Choice choice : branch.getChoices()) {
final EditPart choiceEditPart = (EditPart)getViewer().getEditPartRegistry().get(choice);
choiceEditPart.refresh();
for (PossibleStep possibleStep : choice.getPossibleSteps()) {
final EditPart possibleStepEditPart = (EditPart)getViewer().getEditPartRegistry().get(
possibleStep);
possibleStepEditPart.refresh();
}
}
}
}
示例9: createEditPart
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public EditPart createEditPart(EditPart context, Object model) {
final EditPart res;
if (model instanceof PossibleStep) {
res = new PossibleStepEditPart(withLabel);
} else if (model instanceof Connection) {
res = new ConnectionEditPart();
} else if (model instanceof Choice) {
res = new ChoiceEditPart();
} else if (model instanceof Branch) {
res = new BranchEditPart();
} else if (model instanceof TimelineWindow) {
res = new TimelineWindowEditPart();
} else {
throw new IllegalStateException("don't know what to do with " + model.getClass().getName());
}
res.setModel(model);
return res;
}
示例10: checkWatcher
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* Return true if watch point enable otherwise false
*
* @return boolean
*/
public boolean checkWatcher(Component selectedComponent, String portName) {
ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor).getAdapter(GraphicalViewer.class);
for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator.hasNext();) {
EditPart editPart = iterator.next();
if (editPart instanceof ComponentEditPart) {
Component comp = ((ComponentEditPart) editPart).getCastedModel();
if (comp.equals(selectedComponent)) {
List<PortEditPart> portEditParts = editPart.getChildren();
for (AbstractGraphicalEditPart part : portEditParts) {
if (part instanceof PortEditPart) {
String port_Name = ((PortEditPart) part).getCastedModel().getTerminal();
if (port_Name.equals(portName)) {
return ((PortEditPart) part).getPortFigure().isWatched();
}
}
}
}
}
}
return false;
}
示例11: getSubJobList
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* Collect all subjob file from active editor, also check for nested subjob.
* @return list of subjob.
*/
public List<String> getSubJobList() {
ArrayList<String> subJobList=new ArrayList<>();
ELTGraphicalEditor editor = (ELTGraphicalEditor)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (editor != null && editor instanceof ELTGraphicalEditor) {
GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
.getAdapter(GraphicalViewer.class);
for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry().values().iterator(); ite.hasNext();) {
EditPart editPart = ite.next();
if (editPart instanceof ComponentEditPart) {
Component component = ((ComponentEditPart) editPart).getCastedModel();
if(Constants.SUBJOB_COMPONENT.equals(component.getComponentName())){
String subJobPath=(String) component.getProperties().get(Constants.PATH_PROPERTY_NAME);
subJobList.add(subJobPath);
checkNestedSubJob(subJobList, subJobPath);
}
}
}
}
return subJobList;
}
示例12: execute
import org.eclipse.gef.EditPart; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (DebugHelper.INSTANCE.hasMoreWatchPoints()) {
ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getActiveEditor();
GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
.getAdapter(GraphicalViewer.class);
for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator
.hasNext();) {
EditPart editPart = (EditPart) iterator.next();
if (editPart instanceof ComponentEditPart) {
Component comp = ((ComponentEditPart) editPart).getCastedModel();
comp.clearWatchers();
} else if (editPart instanceof PortEditPart) {
((PortEditPart) editPart).getPortFigure().removeWatcherColor();
((PortEditPart) editPart).getPortFigure().setWatched(false);
((PortEditPart) editPart).getCastedModel().setWatched(false);
}
}
showMessage(Messages.WATCH_POINT_REMOVED_SUCCESSFULLY);
} else {
showMessage(Messages.NO_WATCH_POINT_AVAILABLE);
}
return null;
}
示例13: getUniqueJobId
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* Gets the unique job id.
*
* @return the unique job id
*/
private String getUniqueJobId(){
ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor();
String uniqueJobId = editor.getJobId();
isJobUpdated =false;
GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor).getAdapter(GraphicalViewer.class);
for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry().values().iterator();ite.hasNext();){
EditPart editPart = (EditPart) ite.next();
if (editPart instanceof ComponentEditPart){
Component component = ((ComponentEditPart) editPart)
.getCastedModel();
if(component.getStatus()!= ComponentExecutionStatus.BLANK){
isJobUpdated = true;
break;
}
}
}
return uniqueJobId;
}
示例14: clearTrackingStatusForEditor
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* Clear tracking status for editor.
*
* @param editor
* the editor
*/
public void clearTrackingStatusForEditor(ELTGraphicalEditor editor) {
GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
.getAdapter(GraphicalViewer.class);
for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry()
.values().iterator(); ite.hasNext();) {
EditPart editPart = ite.next();
if (editPart instanceof ComponentEditPart) {
Component component = ((ComponentEditPart) editPart)
.getCastedModel();
component.updateStatus(ComponentExecutionStatus.BLANK.value());
} else if (editPart instanceof LinkEditPart) {
((LinkEditPart) editPart).clearRecordCountAtPort();
}
}
}
示例15: hasMoreWatchPoints
import org.eclipse.gef.EditPart; //導入依賴的package包/類
/**
* This function will check watch point in the graph and return true if any watch point exist
*
*/
public boolean hasMoreWatchPoints(){
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if(activeEditor instanceof ELTGraphicalEditor){
ELTGraphicalEditor editor=(ELTGraphicalEditor) activeEditor;
if(editor!=null){
GraphicalViewer graphicalViewer =(GraphicalViewer) ((GraphicalEditor)editor).getAdapter(GraphicalViewer.class);
for (Object objectEditPart : graphicalViewer.getEditPartRegistry().values()){
if(objectEditPart instanceof ComponentEditPart){
List<PortEditPart> portEditParts = ((EditPart) objectEditPart).getChildren();
for(AbstractGraphicalEditPart part : portEditParts) {
if(part instanceof PortEditPart){
boolean isWatch = ((PortEditPart)part).getPortFigure().isWatched();
if(isWatch){
return isWatch;
}
}
}
}
}
}
}
return false;
}