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


Java IWorkbench類代碼示例

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


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

示例1: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void init(IWorkbench targetWorkbench, IStructuredSelection currentSelection) {
	this.selection = currentSelection;

	List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
	if (!selectedResources.isEmpty()) {
		this.selection = new StructuredSelection(selectedResources);
	}

	setWindowTitle("AsciiDoc Specification Export");
	setNeedsProgressMonitor(true);

	configAdocPage = new SpecConfigAdocPage("Configuration Page");
	processAdocPage = new SpecProcessPage("Process Page");
	comparePage = new SpecComparePage("Compare Page", "Adoc");
	summaryPage = new SpecExportCodeSummaryPage("Summary Page");
	configOutputPage = new SpecConfigOutputPage("Configuration Page");
	processOutputPage = new SpecProcessPage("Process Page");

	taskGenAdoc = new TaskGenerateAdoc(jsDoc2SpecProcessor, resourceSetProvider, n4JSCore, selection,
			configAdocPage, processAdocPage);
	taskWriteFiles = new TaskWriteFiles(processOutputPage, taskGenAdoc);

	addVisibilityListeners();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:ADocSpecExportWizard.java

示例2: showPreferenceDialogMAC

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
private SWTBotShell showPreferenceDialogMAC() {
	final IWorkbench workbench = PlatformUI.getWorkbench();
	workbench.getDisplay().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
			if (window != null) {
				Menu appMenu = workbench.getDisplay().getSystemMenu();
				for (MenuItem item : appMenu.getItems()) {
					if (item.getText().startsWith("Preferences")) {
						Event event = new Event();
						event.time = (int) System.currentTimeMillis();
						event.widget = item;
						event.display = workbench.getDisplay();
						item.setSelection(true);
						item.notifyListeners(SWT.Selection, event);
						break;
					}
				}
			}
		}
	});
	return  getPreferenceDialog() ;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:24,代碼來源:GW4EPreferencePage.java

示例3: getEditor

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
protected AvroSchemaEditor getEditor() {
	
	IWorkbench workbench = PlatformUI.getWorkbench();
       IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();

       if (window != null) {
           IWorkbenchPage workbenchPage = window.getActivePage();
           if (workbenchPage != null) {
           	IWorkbenchPart activePart = workbenchPage.getActivePart();                
               if (activePart instanceof IWithAvroSchemaEditor) {
               	return ((IWithAvroSchemaEditor) activePart).getEditor();
               }
           }
       }
       
       return null;
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:18,代碼來源:SchemaEditorPropertyTester.java

示例4: editFile

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
public static IEditorPart editFile(File file, boolean preferIdeEditor) throws IOException, PartInitException {

        if (file == null || !file.exists() || !file.isFile() || !file.canRead()) {
            throw new IOException("Invalid file: '" + file + "'");
        }

        IWorkbench workBench = PlatformUI.getWorkbench();
        IWorkbenchPage page = workBench.getActiveWorkbenchWindow().getActivePage();
        IPath location = Path.fromOSString(file.getAbsolutePath());

        IFileStore fileStore = EFS.getLocalFileSystem().getStore(location);
        FileStoreEditorInput fileStoreEditorInput = new FileStoreEditorInput(fileStore);

        String editorId = IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID;
        if (preferIdeEditor) {
            IEditorDescriptor editorDescriptor = workBench.getEditorRegistry().getDefaultEditor(file.getName());
            if (editorDescriptor != null) {
                editorId = editorDescriptor.getId();
            }
        }

        return page.openEditor(fileStoreEditorInput, editorId);
    }
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:24,代碼來源:FileEditor.java

示例5: stop

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void stop ()
{
    if ( !PlatformUI.isWorkbenchRunning () )
    {
        return;
    }
    final IWorkbench workbench = PlatformUI.getWorkbench ();
    final Display display = workbench.getDisplay ();
    display.syncExec ( new Runnable () {
        @Override
        public void run ()
        {
            if ( !display.isDisposed () )
            {
                workbench.close ();
            }
        }
    } );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:Application.java

示例6: search

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
protected void search(String pattern, SearchType type, boolean withRef) {    	    	
	IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    IEditorPart editorPart = workbenchPage.getActiveEditor();
    if (editorPart instanceof IWithAvroSchemaEditor) {
    	AvroSchemaEditor schemaEditor = ((IWithAvroSchemaEditor) editorPart).getEditor();        	
    	AvroContext masterContext = schemaEditor.getContext().getMaster();
    	SearchNodeContext searchNodeContext = masterContext.getSearchNodeContext();
    	if (pattern == null || pattern.trim().isEmpty()) {
    		searchNodeContext.reset();
    	} else if (searchNodeContext.searchNodes(type, pattern, withRef)) {
    		AvroNode node = searchNodeContext.next();
    		schemaEditor.getContentPart()
    			.getSchemaViewer(AvroContext.Kind.MASTER)
    			.setSelection(new StructuredSelection(node), true);
    	}
    	refreshCommands(editorPart, SearchNodePropertyTester.PROPERTIES);
    }
}
 
開發者ID:Talend,項目名稱:avro-schema-editor,代碼行數:21,代碼來源:SearchNodeControl.java

示例7: unsafeGetWorkbenchPage

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
static private final IWorkbenchPage unsafeGetWorkbenchPage() {
	IWorkbenchPage page = null;
	if (PlatformUI.isWorkbenchRunning()) {
		IWorkbench wb = PlatformUI.getWorkbench();
		IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
		page = win.getActivePage();
	}
	return page;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:10,代碼來源:EditorsUtil.java

示例8: getActivePage

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
/***/
@SuppressWarnings("restriction")
protected IWorkbenchPage getActivePage() {
	IWorkbenchPage page = null;
	if (org.eclipse.ui.internal.Workbench.getInstance() != null) {
		IWorkbench wb = PlatformUI.getWorkbench();
		IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
		// Could be null if using Timeout test rule and does not run on main thread.
		if (null != window) {
			page = window.getActivePage();
		}
	}
	return page;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:AbstractBuilderTest.java

示例9: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void init(IWorkbench workbench) {
	getPreferenceStore().setDefault(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT);
	getPreferenceStore().setDefault(LOG_LEVEL_PREFERENCE,DEFUALT_LOG_LEVEL);
	String value = Activator.getDefault().getPreferenceStore()
			.getString(SAVE_JOB_BEFORE_RUN_PREFRENCE);
	if (StringUtils.equals(MessageDialogWithToggle.ALWAYS, value)) {
		getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, value);
	} else {
		getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT);
	}
	
	
	String log_level_value= Activator.getDefault().getPreferenceStore().getString(JobRunPreference.LOG_LEVEL_PREFERENCE);
	
	if (StringUtils.isNotBlank(log_level_value)) {
		getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, log_level_value);
	} else {
		getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, DEFUALT_LOG_LEVEL);
	}
	
	String consoleBufferValue = Activator.getDefault().getPreferenceStore().getString(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME);
	if(StringUtils.isNotBlank(consoleBufferValue)){
		getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME, consoleBufferValue);
	}else{
		getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME, Constants.DEFUALT_CONSOLE_BUFFER_SIZE);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:29,代碼來源:JobRunPreference.java

示例10: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
	this.workbench = workbench;
	this.selection = selection;
	setWindowTitle((MessageUtil.getString("GraphWalker_Conversion_File"))); //$NON-NLS-1$
	setDefaultPageImageDescriptor(WIZARD_BANNER);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:8,代碼來源:ConvertToFileCreationWizard.java

示例11: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
	this.selection = currentSelection;

	setWindowTitle(NFARExportMessages.WizardTitle_export);
	setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
			"org.eclipse.ui.ide", "$nl$/icons/full/wizban/exportzip_wiz.png"));//$NON-NLS-1$
	setNeedsProgressMonitor(true);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:10,代碼來源:NFARExportWizard.java

示例12: resetEclipseWorkingSetsBaseOnCurrentState

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
/**
 * Resets the state of all Eclipse based working sets that belong to the 'Resources' type.
 */
private void resetEclipseWorkingSetsBaseOnCurrentState() {
	try {
		if (getWorkbench() == null || getWorkbench().getWorkingSetManager() == null) {
			return; // happens during shutdown
		}

		// Removed listener otherwise due to the Eclipse based working set deletion
		// we would delete our content.
		getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);

		deleteEclipseResourcesWorkingSets();
		final IWorkingSetManager manager = getWorkbench().getWorkingSetManager();
		for (final WorkingSet workingSet : getAllWorkingSets()) {
			if (!OTHERS_WORKING_SET_ID.equals(workingSet.getId())) {
				org.eclipse.ui.internal.WorkingSet eclipseWorkingSet = createEclipseWorkingSet(workingSet);
				eclipseWorkingSet.setId(WorkingSetManagerModificationStrategy.RESOURCE_WORKING_SET_ID);
				manager.addWorkingSet(eclipseWorkingSet);
			}
		}
	} finally {
		IWorkbench wb = getWorkbench();
		if (wb != null) {
			IWorkingSetManager wsm = wb.getWorkingSetManager();
			if (wsm != null) { // null-safe re-adding (can be null during shutdown)
				wsm.addPropertyChangeListener(this);
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:33,代碼來源:ManualAssociationAwareWorkingSetManager.java

示例13: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
@Override
public void init(final IWorkbench workbench, final IStructuredSelection selection) {
	if (selection != null && !selection.isEmpty()) {
		final Object firstElement = selection.getFirstElement();
		if (firstElement instanceof WorkingSet) {
			editedWorkingSet = (WorkingSet) firstElement;
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:10,代碼來源:WorkingSetEditWizard.java

示例14: init

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
/**
 * 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(InfrastructureEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
	setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(InfrastructureEditorPlugin.INSTANCE.getImage("full/wizban/NewInfrastructure")));
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:13,代碼來源:InfrastructureModelWizard.java

示例15: initN4Context

import org.eclipse.ui.IWorkbench; //導入依賴的package包/類
private void initN4Context() {
	if (isWorkbenchRunning()) {
		final IWorkbench workbench = getWorkbench();
		workbench.getDisplay().asyncExec(() -> {
			final IContextService service = workbench.getService(IContextService.class);
			service.activateContext(N4_CONTEXT_ID);
		});
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:10,代碼來源:N4JSApplicationWorkbenchWindowAdvisor.java


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