当前位置: 首页>>代码示例>>Java>>正文


Java IDE类代码示例

本文整理汇总了Java中org.eclipse.ui.ide.IDE的典型用法代码示例。如果您正苦于以下问题:Java IDE类的具体用法?Java IDE怎么用?Java IDE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IDE类属于org.eclipse.ui.ide包,在下文中一共展示了IDE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileEditor

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
/** get editor for given file */
private static final Optional<IEditorPart> getFileEditor(IFile file, IWorkbenchPage page, String editorID) {
	AtomicReference<IEditorPart> wrappedEditor = new AtomicReference<>();

	Display.getDefault().syncExec(() -> {
		try {
			wrappedEditor.set(IDE.openEditor(page, file, editorID, true));
		} catch (Exception e) {
			logger.error("exception when opening edotri for " + file.getRawLocationURI(), e);
		}
	});

	IEditorPart internalFileEditor = wrappedEditor.get();
	if (internalFileEditor == null)
		logger.warn("cannot obtain editor for a file " + file.getRawLocationURI());

	return Optional.ofNullable(internalFileEditor);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:EditorsUtil.java

示例2: getFileEditor

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
private IEditorPart getFileEditor(final IFile file1, final IWorkbenchPage page) {
	internalFileEditor = null;
	Display.getCurrent().syncExec(new Runnable() {

		@Override
		public void run() {
			try {
				internalFileEditor = IDE.openEditor(page, file1, getEditorId(), true);
			} catch (PartInitException e) {
				e.printStackTrace();
			}
		}
	});
	long start = System.currentTimeMillis();
	long end = start;
	do {
		end = System.currentTimeMillis();
	} while (page.getActiveEditor() != internalFileEditor && (end - start) < 5000);
	return internalFileEditor;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:AbstractBuilderParticipantTest.java

示例3: init

import org.eclipse.ui.ide.IDE; //导入依赖的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

示例4: run

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Override
public void run() {
    if (isEnabled()) {
        try {
            ITextEditor editor = (ITextEditor) IDE.openEditor(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
                    segment.getParentFile(), EDITOR.SQL, true);
            editor.setHighlightRange(segment.offset, segment.length, true);
            editor.selectAndReveal(segment.offset, segment.length);
        } catch (PartInitException e) {
            Log.log(e);
            ExceptionNotifier.notifyDefault(Messages.PgNavigatorActionProvider_failed_to_open_editor, e);
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:16,代码来源:NavigatorOutlineActionProvider.java

示例5: openManifestForProject

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
public static void openManifestForProject(IProject project) {
	File fileToOpen = new File(project.getFile("META-INF/MANIFEST.MF")
			.getLocation().toOSString());
	if (fileToOpen.exists() && fileToOpen.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				fileToOpen.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:19,代码来源:OpenEditor.java

示例6: openFile

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
public static void openFile(File file) {
	if (file.exists() && file.isFile()) {
		IFileStore fileStore = EFS.getLocalFileSystem().getStore(
				file.toURI());
		IWorkbenchPage page = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();

		try {
			IDE.openEditorOnFileStore(page, fileStore);
		} catch (PartInitException e) {
			// Put your exception handler here if you wish to
		}
	} else {
		// Do something if the file does not exist
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:17,代码来源:OpenEditor.java

示例7: openEditor

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
private Container openEditor(IPath jobFilePath) throws CoreException {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if (!isJobAlreadyOpen(jobFilePath)) {
		if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()) {
			IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath);
			IDE.openEditor(page, iFile);
	} else {
		if (jobFilePath.toFile().exists()) {
			IFileStore fileStore = EFS.getLocalFileSystem().fromLocalFile(jobFilePath.toFile());
			IEditorInput store = new FileStoreEditorInput(fileStore);
			IDE.openEditorOnFileStore(page, fileStore);
		}
	}

	return SubJobUtility.getCurrentEditor().getContainer();
	}else
		MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error",
				"Unable to open subjob : "+jobFilePath.lastSegment()+" Subjob is already open \n" +
						"Please close the job and retry");
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:SubJobOpenAction.java

示例8: focusMarker

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
public static void focusMarker(final IMarker marker) {
  Display.getDefault().syncExec(new Runnable() {

    @Override
    public void run() {
      try {
        IDE.openEditor(
            MarkerActivator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage(),
            marker);
      } catch (final PartInitException e1) {

        e1.printStackTrace();
      }
    }
  });
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:17,代码来源:MarkUtilities.java

示例9: run

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Override
public void run(IIntroSite site, Properties params) {
	WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
		@Override
		protected void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
			IProject project = createProject(monitor);
			createExample(project);
		}
	};
	try {
		PlatformUI.getWorkbench().getProgressService().run(true, true, op);
		final IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
		IIntroPart part = introManager.getIntro();
		introManager.closeIntro(part);
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		IDE.openEditor(page, ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("hello-world/greeter.sol")));
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:21,代码来源:KickStartNewProjectAction.java

示例10: performFinish

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Override
public boolean performFinish() {
	IFile file = mainPage.createNewFile();
	if (file == null) {
		return false;
	}

	selectAndReveal(file);

	// Open editor on new file.
	IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
	try {
		if (dw != null) {
			IWorkbenchPage page = dw.getActivePage();
			if (page != null) {
				IDE.openEditor(page, file, true);
			}
		}
	} catch (PartInitException e) {
		openError(dw.getShell(), "Problems opening editor", e.getMessage(), e);
	}

	return true;
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:25,代码来源:NewFileWizard.java

示例11: openInEditor

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
public static void openInEditor(IFile file, int startpos, int length) {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	HashMap map = new HashMap();
	map.put(IMarker.CHAR_START, new Integer(startpos));
	map.put(IMarker.CHAR_END, new Integer(startpos+length));
	map.put(IWorkbenchPage.EDITOR_ID_ATTR, 
			"org.eclipse.ui.DefaultTextEditor");
	try {
		IMarker marker = file.createMarker(IMarker.TEXT);
		marker.setAttributes(map);

		IDE.openEditor(page, marker);
	} catch (Exception e) {
		e.printStackTrace();
	}
   }
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:18,代码来源:RulesView.java

示例12: testTMHighlightInGenericEditor

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Test
public void testTMHighlightInGenericEditor() throws IOException, PartInitException {
	f = File.createTempFile("test" + System.currentTimeMillis(), ".ts");
	FileOutputStream fileOutputStream = new FileOutputStream(f);
	fileOutputStream.write("let a = '';\nlet b = 10;\nlet c = true;".getBytes());
	fileOutputStream.close();
	f.deleteOnExit();
	editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
			f.toURI(), editorDescriptor.getId(), true);
	StyledText text = (StyledText)editor.getAdapter(Control.class);
	new DisplayHelper() {
		@Override
		protected boolean condition() {
			return text.getStyleRanges().length > 1;
		}
	}.waitForCondition(text.getDisplay(), 3000);
	Assert.assertTrue(text.getStyleRanges().length > 1);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:19,代码来源:TMinGenericEditorTest.java

示例13: testTMHighlightInGenericEditorEdit

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Test
public void testTMHighlightInGenericEditorEdit() throws IOException, PartInitException {
	f = File.createTempFile("test" + System.currentTimeMillis(), ".ts");
	FileOutputStream fileOutputStream = new FileOutputStream(f);
	fileOutputStream.write("let a = '';".getBytes());
	fileOutputStream.close();
	f.deleteOnExit();
	editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
			f.toURI(), editorDescriptor.getId(), true);
	StyledText text = (StyledText)editor.getAdapter(Control.class);
	new DisplayHelper() {
		@Override
		protected boolean condition() {
			return text.getStyleRanges().length > 1;
		}
	}.waitForCondition(text.getDisplay(), 3000);
	int numberOfRanges = text.getStyleRanges().length;
	Assert.assertTrue(numberOfRanges > 1);
	text.setText("let a = '';\nlet b = 10;\nlet c = true;");
	DisplayHelper.runEventLoop(text.getDisplay(), 3000);
	Assert.assertTrue("More styles should have been added", text.getStyleRanges().length > numberOfRanges + 3);
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:23,代码来源:TMinGenericEditorTest.java

示例14: performFinish

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
@Override
public boolean performFinish() {
	boolean result = false;
	
	IFile file = page.createNewFile();
	result = file != null;
	
	if (result) {
		try {
			IDE.openEditor(workbench.getActiveWorkbenchWindow().getActivePage(), file);
		} catch (PartInitException e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}
	
	return result;
}
 
开发者ID:Imhotup,项目名称:LibertyEiffel-Eclipse-Plugin,代码行数:19,代码来源:NewEiffelClassFile.java

示例15: updateWorkingSetScope

import org.eclipse.ui.ide.IDE; //导入依赖的package包/类
private void updateWorkingSetScope() {
	if(workingSets != null) {
		List allWorkingSetResources = new ArrayList();
		for (int i = 0; i < workingSets.length; i++) {
			IWorkingSet set = workingSets[i];
			allWorkingSetResources.addAll(IDE.computeSelectedResources(new StructuredSelection(set.getElements())));
		}
		scopeCheckingElement = true;
		fViewer.setCheckedElements(allWorkingSetResources.toArray(new IResource[allWorkingSetResources.size()]));
		scopeCheckingElement = false;
		setPageComplete(true);
	} else {
		scopeCheckingElement = true;
		fViewer.setCheckedElements(new Object[0]);
		scopeCheckingElement = false;
		setPageComplete(false);
	}
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:GlobalRefreshResourceSelectionPage.java


注:本文中的org.eclipse.ui.ide.IDE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。