Java Code Examples for org.eclipse.ui.IWorkbenchPartReference#getId()

The following examples show how to use org.eclipse.ui.IWorkbenchPartReference#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MOOSETreeCompositeView.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This is called when an editor has been activated. If that part is a
 * {@link MOOSEFormEditor}, mark it as the active editor and refresh the
 * content of this view.
 */
@Override
public void partActivated(IWorkbenchPartReference partRef) {

	String partId = partRef.getId();
	IWorkbenchPart part = partRef.getPart(false);

	if (MOOSEFormEditor.ID.equals(partId) && part != editor) {

		// Set the new active editor.
		editor = (MOOSEFormEditor) part;
		ICEFormInput formInput = (ICEFormInput) editor.getEditorInput();
		form = formInput.getForm();

		// Set the MOOSE tree based on the editor's current configuration.
		int treeId = MOOSEModel.mooseTreeCompositeId;
		setInput((TreeComposite) form.getComponent(treeId), editor);
	}

	return;
}
 
Example 2
Source File: ActiveEditorTracker.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Set the active editor
 */
private void setActiveEditor(IEditorPart part) {
	if (part == null) {
		lastActiveEditorId = null;
		return;
	}
	final IWorkbenchPartReference reference = activePage.getReference(part);
	if (reference == null)
		throw new IllegalStateException("Impossible?!");
	lastActiveEditorId = reference.getId();
	activeEditors.put(lastActiveEditorId, part);
}
 
Example 3
Source File: ASTProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isJavaEditor(IWorkbenchPartReference ref) {
	if (ref == null)
		return false;

	String id= ref.getId();

	// The instanceof check is not need but helps clients, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=84862
	return JavaUI.ID_CF_EDITOR.equals(id) || JavaUI.ID_CU_EDITOR.equals(id) || ref.getPart(false) instanceof JavaEditor;
}
 
Example 4
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void partVisible(IWorkbenchPartReference ref) {
	if (ref != null && ref.getId() == getSite().getId()){
		fProcessSelectionEvents= true;
		IWorkbenchPage page= getSite().getWorkbenchWindow().getActivePage();
		if (page != null) {
			ISelection selection= page.getSelection();
			if (selection != null)
				selectionChanged(page.getActivePart(), selection);
		}
	}
}
 
Example 5
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void partHidden(IWorkbenchPartReference ref) {
	if (ref != null && ref.getId() == getSite().getId())
		fProcessSelectionEvents= false;
}