本文整理匯總了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();
}
示例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() ;
}
示例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;
}
示例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);
}
示例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 ();
}
}
} );
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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")));
}
示例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);
});
}
}