當前位置: 首頁>>代碼示例>>Java>>正文


Java IWorkbenchPartReference類代碼示例

本文整理匯總了Java中org.eclipse.ui.IWorkbenchPartReference的典型用法代碼示例。如果您正苦於以下問題:Java IWorkbenchPartReference類的具體用法?Java IWorkbenchPartReference怎麽用?Java IWorkbenchPartReference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IWorkbenchPartReference類屬於org.eclipse.ui包,在下文中一共展示了IWorkbenchPartReference類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createHandler

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
/**
 * Creates and returns a new IGazeHandler object from the specified object
 * and partRef, or returns null if no handler object is defined for that object.
 */
public static IGazeHandler createHandler(Object target,
        IWorkbenchPartReference partRef) {
	
	// create gaze handler for a StyledText widget within an EditorPart
    if (target instanceof StyledText &&
            partRef instanceof IEditorReference) {
        return new StyledTextGazeHandler(target); //can go back to using partRef
    
    } else if (target instanceof Browser) {
    	//create gaze handler for a Browser Stack overflow and Bug Report widget
    	//cannot get associated partRef
    	return new BrowserGazeHandler(target);

    } else if (target instanceof Tree &&
    		partRef instanceof IViewReference &&
    		partRef.getTitle().equals("Project Explorer")) {
    	//create gaze handler for a Project Explorer Tree
        return new ProjectExplorerGazeHandler(target, partRef);
    }

    return null;
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:27,代碼來源:GazeHandlerFactory.java

示例2: bindControl

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
/**
 * Bind a control. If it is a composite, also bind all of its children.
 * @param control Highest level control.
 * @param unbind If true, unbind instead of bind.
 */
private static void bindControl(IWorkbenchPartReference partRef,
		Control control, boolean unbind) {
    //If composite, bind children.
    if (control instanceof Composite) {
        Composite composite = (Composite) control;

        Control[] children = composite.getChildren();
        if (children.length > 0 && children[0] != null) {
           for (Control curControl : children)
               bindControl(partRef, curControl, unbind);
        }
    }
    
    //control should not have any data set
    //upon reaching this part of the method
    IGazeHandler handler = GazeHandlerFactory.
                           createHandler(control, partRef);
    if (handler != null && !unbind)
        control.setData(KEY_HANDLER, handler);
    else
        control.setData(KEY_HANDLER, null);
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:28,代碼來源:HandlerBindManager.java

示例3: setupControls

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
/**
 * Find controls within a part, set it up to be used by iTrace,
 * and extract meta-data from it.
 * 
 * @param partRef partRef that just became visible.
 */
private void setupControls(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(true);
    Control control = part.getAdapter(Control.class);
    //set up manager for control and managers for each child control if necessary
    if (control != null) {
    	setupControls(part, control);
    } else {
    	//Browser - always set up browser managers, no matter the partRef that
    	//has become visible
    	//not possible to get Browser control from a partRef
    	Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
    	for (Control ctrl: workbenchShell.getChildren()) {
    		setupBrowsers(ctrl);
    	}
    }
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:23,代碼來源:ControlView.java

示例4: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) {
		de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor editor = (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:DwprofileCodeFoldingManager.java

示例5: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) {
		eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor editor = (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HyexpressionCodeFoldingManager.java

示例6: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) {
		eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor editor = (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HyvalidityformulaCodeFoldingManager.java

示例7: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) {
		eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor editor = (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HydatavalueCodeFoldingManager.java

示例8: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) {
		eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor editor = (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HymappingCodeFoldingManager.java

示例9: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) {
		eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor editor = (eu.hyvar.feature.constraint.resource.hyconstraints.ui.HyconstraintsEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HyconstraintsCodeFoldingManager.java

示例10: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	if (partRef.isDirty()) {
		return;
	}
	IWorkbenchPart workbenchPart = partRef.getPart(false);
	if (workbenchPart instanceof eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) {
		eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor editor = (eu.hyvar.mspl.manifest.resource.hymanifest.ui.HymanifestEditor) workbenchPart;
		Resource editorResource = editor.getResource();
		if (editorResource == null) {
			return;
		}
		String uri = editorResource.getURI().toString();
		Resource thisEditorResource = this.editor.getResource();
		URI thisEditorResourceURI = thisEditorResource.getURI();
		if (uri.equals(thisEditorResourceURI.toString())) {
			saveCodeFoldingStateFile(uri);
			editor.getSite().getPage().removePartListener(this);
		}
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:HymanifestCodeFoldingManager.java

示例11: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
public void partClosed(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(false);
	if (part instanceof CompareEditor) {
		CompareEditor editor = (CompareEditor)part;
		IEditorInput input = editor.getEditorInput();
		String name = input.getName();
		if (name != null && name.startsWith(compareName)) {
			targetPart.getSite().getPage().removePartListener(this);
			if (MessageDialog.openQuestion(getShell(), Messages.ResolveTreeConflictWizard_editorClosed, Messages.ResolveTreeConflictWizard_promptToReolve + treeConflict.getResource().getName() + "?")) { //$NON-NLS-1$
				ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, targetPart);
				WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, "ResolveTreeConflict"); //$NON-NLS-1$
				dialog.open();
			}
		}
	}
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:17,代碼來源:ResolveTreeConflictWizard.java

示例12: partClosed

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
@Override
public void partClosed(IWorkbenchPartReference partRef) {
    if (partRef.getPart(false) == SQLEditor.this && !PlatformUI.getWorkbench().isClosing()
            && getEditorInput() instanceof IFileEditorInput) {
        IFile f = ((IFileEditorInput) getEditorInput()).getFile();
        if (PROJ_PATH.MIGRATION_DIR.equals(f.getProjectRelativePath().segment(0))) {
            askDeleteScript(f);
        }
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:11,代碼來源:SQLEditor.java

示例13: removeSelectionChangeListener

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
private void removeSelectionChangeListener(IWorkbenchPartReference partRef) {
  if (partRef.getPart(false) instanceof IEditorPart) {
    IEditorPart editor = (IEditorPart) partRef.getPart(false);
    initContextualView(editor);
    if (editor instanceof EcoreEditor) {
      EcoreEditor eEditor = (EcoreEditor) editor;
      IFileEditorInput eInput = (IFileEditorInput) eEditor.getEditorInput();
      IFile eFile = eInput.getFile();
      // Removing SelectionChangeListener from editor.
      ((EcoreEditor) editor).getViewer()
          .removeSelectionChangedListener(SelectionChangeListener.getInstance(eFile));
    }
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:15,代碼來源:Startup.java

示例14: bind

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
/**
 * Binds all controls in an IWorkbenchPartReference that is
 * an instance of IEditorPartReference to their appropriate
 * gaze handlers if the handler exists.
 * Binds the IWorkbenchPartReference that is an instance of
 * IViewPartReference to the appropriate gaze handler if the
 * handler exists.
 * @param partRef Workbench part from which to get controls.
 */
public static void bind(IWorkbenchPartReference partRef) {
    IWorkbenchPart part = partRef.getPart(true);
    Control control = part.getAdapter(Control.class);
    System.out.println(control);
    //is an EditorPart
    if (control != null) {
    	bindControl(partRef, control, false);
    //is a ViewPart
    } else {
    	//must be handled on a case to case basis
    	
    	//Browser - always look through all controls in the shell for browsers and bind them
    	//regardless of the partRef that has become visible
    	//not possible to get a Browser control from a partRef
    	Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
    	for (Control ctrl : workbenchShell.getChildren()) {
    		bind(ctrl); //call recursive helper function to find all browser controls
    	}
    	
    	//Project Explorer
    	if (part.getAdapter(ProjectExplorer.class) != null) {
    		ProjectExplorer explorer = part.getAdapter(ProjectExplorer.class);
    		//this control is the primary control associated with a ProjectExplorer
    		Control viewControl = explorer.getCommonViewer().getControl();
    		bindControl(partRef, viewControl, false);
    	}
    }
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:38,代碼來源:HandlerBindManager.java

示例15: unbind

import org.eclipse.ui.IWorkbenchPartReference; //導入依賴的package包/類
/**
 * Unbinds all controls in an IWorkbenchPartReference that is an instance
 * of IEditorPartReference which are currently bound to a gaze handler.
 * Unbinds an IWorkbenchPartReference that is an instance of IViewPartReference
 * which is currently bound to a gaze handler.
 * @param partRef Workbench part from which to get controls.
 */
public static void unbind(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(true);
    Control control = part.getAdapter(Control.class);
    
    //is an EditorPart
    if (control != null) {
    	bindControl(partRef, control, true);
    //is a ViewPart
    } else {
    	//must be handled on a case to case basis
    	
    	//Browser - always look through all controls in the shell for browsers and unbind them
    	//regardless of the partRef that has been hidden
    	//not possible to get Browser control from a partRef
    	Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
    	for (Control ctrl : workbenchShell.getChildren()) {
    		unbind(ctrl);
    	}
    	
    	//Project Explorer
    	if (part.getAdapter(ProjectExplorer.class) != null) {
    		ProjectExplorer explorer = part.getAdapter(ProjectExplorer.class);
    		//this control is the primary control associated with a ProjectExplorer
    		Control viewControl = explorer.getCommonViewer().getControl();
    		bindControl(partRef, viewControl, true);
    	}
    }
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:36,代碼來源:HandlerBindManager.java


注:本文中的org.eclipse.ui.IWorkbenchPartReference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。