當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。