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


Java MessageConsoleStream類代碼示例

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


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

示例1: getConsoleOutputStream

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
public OutputStream getConsoleOutputStream(boolean isError) {
	final MessageConsoleStream output = messageConsole.newMessageStream();
	output.setActivateOnWrite(false);
	
	final int colorId;
	if (!isError) {
		colorId = SWT.COLOR_BLACK;
	} else {
		colorId = SWT.COLOR_RED;
	}
	
	/* we must set the color in the UI thread */
	Runnable runnable = new Runnable() {
		public void run() {
			org.eclipse.swt.graphics.Color color = Display.getCurrent()
					.getSystemColor(colorId);
			output.setColor(color);
		}
	};
	Display.getDefault().syncExec(runnable);
	
	return output;
}
 
開發者ID:kwin,項目名稱:cppcheclipse,代碼行數:24,代碼來源:Console.java

示例2: getOutputStream

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
@Override
public OutputStream getOutputStream(final OutputStreamType type, OutputRedirection redirect) {
	if (!PlatformUI.isWorkbenchRunning()) {
		return DEFAULT.getOutputStream(type, redirect);
	}
	final MessageConsole console = consoleSupplier.get();
	boolean silent = redirect == OutputRedirection.SUPPRESS;
	if (!silent) {
		console.activate();
	}
	ConsolePlugin.getDefault().getConsoleManager().addConsoles(new IConsole[] { console });
	final MessageConsoleStream stream = console.newMessageStream();
	getDisplay().asyncExec(() -> {
		stream.setColor(toColor(type));
		showConsoleView(silent);
	});
	return stream;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:19,代碼來源:ConsoleOutputStreamProvider.java

示例3: setUpDeployCloudSdk

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
/**
 * Sets up a {@link CloudSdk} to be used for App Engine deploy.
 */
public void setUpDeployCloudSdk(Path credentialFile, MessageConsoleStream normalOutputStream) {
  Preconditions.checkNotNull(credentialFile, "credential required for deploying");
  Preconditions.checkArgument(Files.exists(credentialFile), "non-existing credential file");
  Preconditions.checkState(cloudSdk == null, "CloudSdk already set up");

  // Structured deploy result (in JSON format) goes to stdout, so prepare to capture that.
  stdOutCaptor = new StringBuilderProcessOutputLineListener();
  // Structured gcloud logs (in JSON format) go to stderr, so prepare to capture them.
  gcloudErrorMessageCollector = new GcloudStructuredLogErrorMessageCollector();

  // Normal operation output goes to stderr.
  MessageConsoleStream stdErrOutputStream = normalOutputStream;
  CloudSdk.Builder cloudSdkBuilder = getBaseCloudSdkBuilder(stdErrOutputStream)
      .appCommandCredentialFile(credentialFile.toFile())
      .appCommandShowStructuredLogs("always")  // turns on gcloud structured log
      .addStdErrLineListener(gcloudErrorMessageCollector)
      .addStdOutLineListener(stdOutCaptor);
  cloudSdk = cloudSdkBuilder.build();
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:23,代碼來源:CloudSdkProcessWrapper.java

示例4: stage

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
@Override
public IStatus stage(IPath stagingDirectory, IPath safeWorkDirectory,
    MessageConsoleStream stdoutOutputStream, MessageConsoleStream stderrOutputStream,
    IProgressMonitor monitor) {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  boolean result = stagingDirectory.toFile().mkdirs();
  if (!result) {
    return StatusUtil.error(this, "Could not create staging directory " + stagingDirectory);
  }

  try {
    IPath deployArtifact = getDeployArtifact(safeWorkDirectory, subMonitor.newChild(40));
    CloudSdkStagingHelper.stageFlexible(appEngineDirectory, deployArtifact, stagingDirectory,
        subMonitor.newChild(60));
    return Status.OK_STATUS;
  } catch (AppEngineException | CoreException ex) {
    return StatusUtil.error(this, Messages.getString("deploy.job.staging.failed"), ex);
  } finally {
    subMonitor.done();
  }
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:23,代碼來源:FlexStagingDelegate.java

示例5: initializeDevServer

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
private void initializeDevServer(MessageConsoleStream stdout, MessageConsoleStream stderr,
    Path javaHomePath) {
  MessageConsoleWriterOutputLineListener stdoutListener =
      new MessageConsoleWriterOutputLineListener(stdout);
  MessageConsoleWriterOutputLineListener stderrListener =
      new MessageConsoleWriterOutputLineListener(stderr);

  // dev_appserver output goes to stderr
  cloudSdk = new CloudSdk.Builder()
      .javaHome(javaHomePath)
      .addStdOutLineListener(stdoutListener).addStdErrLineListener(stderrListener)
      .addStdErrLineListener(serverOutputListener)
      .startListener(localAppEngineStartListener)
      .exitListener(localAppEngineExitListener)
      .async(true)
      .build();

  devServer = LocalAppEngineServerLaunchConfigurationDelegate.DEV_APPSERVER2
      ? new CloudSdkAppEngineDevServer2(cloudSdk)
      : new CloudSdkAppEngineDevServer1(cloudSdk);
  moduleToUrlMap.clear();
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:23,代碼來源:LocalAppEngineServerBehaviour.java

示例6: RemoteUtility

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
public RemoteUtility(
		String hostName, 
		String userName, 
		String userPassword,
		MessageConsoleStream consoleStream) {
	
	// Setting attributes
	setHostName(hostName);
	setUserName(userName);
	setUserPassword(userPassword);
	setConsoleStream(consoleStream);
	
	setConnection(new Connection(getHostName()));
	
	setVerboseMode(false);
}
 
開發者ID:ncleclipse,項目名稱:ncl30-eclipse,代碼行數:17,代碼來源:RemoteUtility.java

示例7: execute

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
@Override
public Object execute(ExecutionEvent event) {
	
	try {
		this.showConsole(event);
		this.clearConsole();
		
		IFile file = this.getSelectedFile(event);
		String umlModelPath = file.getLocation().toFile().getAbsolutePath();
		String toscaModelPath = file.getLocation().toFile().getAbsolutePath();
		toscaModelPath = toscaModelPath.replace(".uml", ".tosca");
		
		MessageConsoleStream outStream = console.newMessageStream();
		outStream.println("Translating " + umlModelPath + " into " + toscaModelPath);
		
		CAML2TOSCALauncher launcher = new CAML2TOSCALauncher();
		launcher.runCAML2TOSCATemplates(umlModelPath, toscaModelPath);
		
		outStream.println("Done ;)");
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	
	return null;
}
 
開發者ID:alexander-bergmayr,項目名稱:caml2tosca,代碼行數:26,代碼來源:C2TRunHandler.java

示例8: run

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
public void run() {
	try {
		ISelection selection = treeViewer.getSelection();
		Object obj = ((IStructuredSelection) selection).getFirstElement();

		if (obj instanceof Test) {
			if (((Test) obj).getStatus().equals("Actual run")) {
				((Test) obj).setStatus("Not run");
				treeViewer.refresh();
				treeViewer.expandAll();

				Runtime.getRuntime().exec("taskkill /F /IM python.exe");
				MessageConsoleStream out = ConsoleManager
						.getMessageConsoleStream("Console");
				out.println("Test Stop");
				
				runTestAction.setEnabled(true);
				this.setEnabled(false);
			}
		}

	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
開發者ID:FutureProcessing,項目名稱:RFRunnerPlugin,代碼行數:27,代碼來源:StopTestAction.java

示例9: writeToConsole

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
/**
 * Displays the specified text at the console, followed by a line
 * separator string.
 * 
 * @param text message to display
 * @param lineBreak <tt>true</tt> if a linebreak shall be inserted after the message.
 * @return <tt>true</tt> if the message was successfully displayed inside the console.
 */
public boolean writeToConsole(String text, boolean lineBreak) {
    boolean isWritten = false;
    if (this.msgConsole != null) {
        MessageConsoleStream out = this.msgConsole.newMessageStream();
        if (lineBreak) {
            out.println(text);
        } else {
            out.print(text);
        }
        try {
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return isWritten;
}
 
開發者ID:SSEHUB,項目名稱:EASyProducer,代碼行數:27,代碼來源:EclipseConsole.java

示例10: run

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
/**
 * Runs the compiler on the selected files using the given processor
 * 
 * @param fileNames
 *            files that need to be type-checked
 * @param processors
 *            Type processors to run
 * @param classpath
 *            The classpath to reference in compilation
 */

public void run()
{
    Iterable<String> opts;

    opts = getOptions(processors, classpath);

    // The following code uses the compiler's internal APIs, which are
    // volatile. (see warning in JavacTool source)
    JavacTool tool = JavacTool.create();
    JavacFileManager manager = tool.getStandardFileManager(collector, null, null);

    Iterable<? extends JavaFileObject> fileObjs = manager.getJavaFileObjectsFromStrings(fileNames);

    CheckerPlugin.getDefault();
    MessageConsole console = CheckerPlugin.findConsole();
    MessageConsoleStream stream = console.newMessageStream();
    Writer writer = new OutputStreamWriter(stream);

    JavacTask task = tool.getTask(writer, manager, collector, opts, null, fileObjs);

    task.call();
    manager.close();
}
 
開發者ID:reprogrammer,項目名稱:checker-framework,代碼行數:35,代碼來源:JavacRunner.java

示例11: getNewMessageConsoleStream

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
private MessageConsoleStream getNewMessageConsoleStream(int msgKind)
{     
    int swtColorId = SWT.COLOR_DARK_GREEN;
    
    switch (msgKind) {
        case MSG_INFORMATION:
            swtColorId = SWT.COLOR_BLACK;
            break;
            
        case MSG_ERROR:
            swtColorId = SWT.COLOR_RED;
            break;
            
        case MSG_WARNING:
            swtColorId = SWT.COLOR_DARK_BLUE;
            break;
            
        default:          
            swtColorId = SWT.COLOR_DARK_MAGENTA;
    }  
    
    MessageConsoleStream msgConsoleStream = getMessageConsole().newMessageStream();     
    msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));
    return msgConsoleStream;
}
 
開發者ID:Elphel,項目名稱:vdt-plugin,代碼行數:26,代碼來源:ConsoleView.java

示例12: checkDescParameters

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
/**
 * Checks Description string.
 * @param name the node name.
 * @param desc the description.
 */
private void checkDescParameters(String name, String desc) {
	Pattern p = Pattern.compile("\\{([^\\}]+)\\}"); //$NON-NLS-1$
	ArrayList<String> paramList = new ArrayList<String>();
	while (true) {
		Matcher m = p.matcher(desc);
		if (! m.find()) {
			break;
		}
		String parameter = m.group(1);
		paramList.add(parameter);
		desc = desc.replaceAll(String.format(PARAM_ITEM_REGEX_FORMAT, parameter), ""); //$NON-NLS-1$
	}
	// found unknown parameters.
	if (paramList.size() > 0) {
		MessageConsoleStream stream = DcaseNodeEditPart.getMessageConsoleStream();
		stream.print(name + ": cannot found "); //$NON-NLS-1$
		for (int i = 0; i < paramList.size(); i++) {
			stream.print(paramList.get(i) + ((i == paramList.size()-1) ? "":",")); //$NON-NLS-1$
		}
		stream.println();
	}
}
 
開發者ID:d-case,項目名稱:d-case_editor,代碼行數:28,代碼來源:BasicNodeOpenEditPolicy.java

示例13: getNewMessageConsoleStream

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
private MessageConsoleStream getNewMessageConsoleStream(int msgKind) {
	int swtColorId = SWT.COLOR_BLACK;

	switch (msgKind) {
	case MSG_LOG:
		swtColorId = SWT.COLOR_BLACK;
		break;
	case MSG_INFORMATION:
		swtColorId = SWT.COLOR_DARK_GRAY;
		break;
	case MSG_ERROR:
		swtColorId = SWT.COLOR_DARK_MAGENTA;
		break;
	case MSG_WARNING:
		swtColorId = SWT.COLOR_DARK_YELLOW;
		break;
	case MSG_SUCCESS:
		swtColorId = SWT.COLOR_DARK_GREEN;
		break;
	default:
		swtColorId = SWT.COLOR_BLACK;
		break;
	}

	MessageConsoleStream msgConsoleStream = messageConsole.newMessageStream();
	msgConsoleStream.setColor(Display.getCurrent().getSystemColor(swtColorId));

	return msgConsoleStream;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:30,代碼來源:XpectConsole.java

示例14: ConsoleContext

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
public ConsoleContext ( final MessageConsole messageConsole )
{
    this.writerStream = messageConsole.newMessageStream ();

    final MessageConsoleStream errorStream = messageConsole.newMessageStream ();
    errorStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_RED ) );
    this.errorPrintWriter = new PrintWriter ( new OutputStreamWriter ( errorStream ) );

    this.logStream = messageConsole.newMessageStream ();
    this.logStream.setColor ( Display.getDefault ().getSystemColor ( SWT.COLOR_GRAY ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:12,代碼來源:ConsoleContext.java

示例15: createConsoles

import org.eclipse.ui.console.MessageConsoleStream; //導入依賴的package包/類
private void createConsoles() {
	ConsolePlugin consolePlugin = ConsolePlugin.getDefault();
	IConsoleManager consoleManager = consolePlugin.getConsoleManager();
	
	stdoutConsole = new MessageConsole("Stdout", ImageDescriptor.createFromFile(getClass(), "/consoles/stdout.gif"));
	stdoutConsole.setTabWidth(TAB_WIDTH);
	stdoutConsoleStream = stdoutConsole.newMessageStream();
	stderrConsoleStream = stdoutConsole.newMessageStream();
	stderrConsoleStream.setColor(stderrConsoleStreamColor);
	
	engineConsole = new MessageConsole("Engine", ImageDescriptor.createFromFile(getClass(), "/consoles/engine.gif"));
	engineConsole.setTabWidth(TAB_WIDTH);
	engineConsoleStream = engineConsole.newMessageStream();

	consoleManager.addConsoles(new IConsole[] {
		engineConsole,
		stdoutConsole
	});
	
	consolePipes = new ConsolePipes();
	
	debugConsoleStream = new MessageConsoleStream(engineConsole) {

		@Override
		public void write(String str) throws IOException {
			if (str.endsWith("\n")) {
				str = str.substring(0, str.length() - 1);
			}
			Engine.logStudio.info("[debug] " + str);
		}
		
	};
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:34,代碼來源:ConvertigoPlugin.java


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