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


Java IHyperlink类代码示例

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


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

示例1: processIOConsole

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@SuppressWarnings("restriction")
private void processIOConsole(IOConsole ioConsole) {
    IDocument document = ioConsole.getDocument();
    try {
        Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
        Arrays.sort(positions, new Comparator<Position>() {

            @Override
            public int compare(Position o1, Position o2) {
                return Integer.compare(o1.getOffset(), o2.getOffset());
            }
        });
        if (positions.length > 0) {
            Position p = positions[positions.length - 1];
            if (p instanceof ConsoleHyperlinkPosition) {
                ConsoleHyperlinkPosition consoleHyperlinkPosition = (ConsoleHyperlinkPosition) p;
                IHyperlink hyperLink = consoleHyperlinkPosition.getHyperLink();
                hyperLink.linkActivated();
            }
        }
    } catch (BadPositionCategoryException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:25,代码来源:PyOpenLastConsoleHyperlink.java

示例2: init

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void init(final IConsole console) {
    IProcess process = console.getProcess();
    if (process != null) {
        ILaunch launch = process.getLaunch();
        if (launch != null) {
            initLaunchConfiguration(launch.getLaunchConfiguration());
        }
    }
    this.linkContainer = new ILinkContainer() {

        @Override
        public void addLink(IHyperlink link, int offset, int length) {
            console.addLink(link, offset, length);
        }

        @Override
        public String getContents(int offset, int length) throws BadLocationException {
            return console.getDocument().get(offset, length);
        }
    };
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:PythonConsoleLineTracker.java

示例3: addLink

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void addLink(IHyperlink link, int offset, int length) {
    if (testOutputText == null) {
        return;
    }
    StyleRangeWithCustomData range = new StyleRangeWithCustomData();
    range.underline = true;
    try {
        range.underlineStyle = SWT.UNDERLINE_LINK;
    } catch (Throwable e) {
        //Ignore (not available on earlier versions of eclipse)
    }

    //Set the proper color if it's available.
    TextAttribute textAttribute = ColorManager.getDefault().getHyperlinkTextAttribute();
    if (textAttribute != null) {
        range.foreground = textAttribute.getForeground();
    } else {
        range.foreground = JFaceColors.getHyperlinkText(Display.getDefault());
    }
    range.start = offset;
    range.length = length + 1;
    range.customData = link;
    testOutputText.setStyleRange(range);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:PyUnitView.java

示例4: mouseUp

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
    Widget w = e.widget;
    if (w instanceof StyledText) {
        StyledText styledText = (StyledText) w;
        int offset = styledText.getCaretOffset();
        if (offset >= 0 && offset < styledText.getCharCount()) {
            StyleRange styleRangeAtOffset = styledText.getStyleRangeAtOffset(offset);
            if (styleRangeAtOffset instanceof StyleRangeWithCustomData) {
                StyleRangeWithCustomData styleRangeWithCustomData = (StyleRangeWithCustomData) styleRangeAtOffset;
                Object l = styleRangeWithCustomData.customData;
                if (l instanceof IHyperlink) {
                    ((IHyperlink) l).linkActivated();
                }
            }
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:19,代码来源:PyUnitView.java

示例5: matchFound

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void matchFound(PatternMatchEvent event)  {
       int offset = event.getOffset();
       int length = event.getLength();
       int prefix = 0;
       
       try {
           String text = fConsole.getDocument().get(offset, length);
           
           IHyperlink link = new EclecticTraceHyperLink(fConsole);

       	fConsole.addHyperlink(link, offset, length);
	} catch (BadLocationException e) {
		e.printStackTrace();
		throw new RuntimeException(e);
		// IStatus status = new Status(IStatus.ERROR, "org.eclectic.debug.ui", 0, "Cannot set link for " + event, e);
		// throw new CoreException(status);	
	}

}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:21,代码来源:PatternMatchListenerDelegate.java

示例6: matchFound

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void matchFound(PatternMatchEvent event) {
    // remove the brackets
    int offset = event.getOffset() + 1;
    int length = event.getLength() - 2;
    try {
        String name = console.getDocument().get(offset, length);
        EObject ref = findBestReference(name);

        if (ref != null) {
            IHyperlink hyperlink = new AgreeConsoleHyperLink(ref);
            console.addHyperlink(hyperlink, offset, length);
        }
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:18,代码来源:AgreePatternListener.java

示例7: matchFound

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void matchFound(PatternMatchEvent event) {
  if (event.getSource() instanceof TextConsole) {
    try {
      final TextConsole console = (TextConsole) event.getSource();
      final int start = event.getOffset();
      final int length = event.getLength();
      IHyperlink link = new BrowserSupportBasedHyperlink(console.getDocument().get(start, length));
      console.addHyperlink(link, start, length);
    } catch (BadLocationException e) {
      logger.log(Level.SEVERE, "Cannot create hyperlink", e);
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:15,代码来源:PatternToHyperlinkConverter.java

示例8: matchFound

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
public void matchFound(PatternMatchEvent event)
{
	try
	{
		String fileReferenceText = console.getDocument().get(event.getOffset(), event.getLength());
		int separatorIndex = fileReferenceText.lastIndexOf(":");

		String absoluteFilePath = fileReferenceText.substring(0, separatorIndex);
		//String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();

		//if (absoluteFilePath.startsWith(workspacePath))
		{
			//String relativeFilePath = absoluteFilePath.substring(workspacePath.length());
			//IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(relativeFilePath));  // this way can work, but only for files in the workspace :(

			int lineNumber = Integer.parseInt(fileReferenceText.substring(separatorIndex + 1));

			//FileLink hyperlink = new FileLink(file, null, -1, -1, lineNumber); // a link to a file in the workspace
			IHyperlink hyperlink = makeHyperlink(absoluteFilePath, lineNumber); // a link to any file
			console.addHyperlink(hyperlink, event.getOffset(), event.getLength());
		}
	}
	catch (Exception exception)
	{
		throw new RuntimeException(exception);
	}
}
 
开发者ID:mjwach,项目名称:ErrorLinkyThing,代码行数:29,代码来源:ErrorLinkyPatternMatchListenerDelegate.java

示例9: makeHyperlink

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
private static IHyperlink makeHyperlink(String absoluteFilePath, int lineNumber)
{
	return new IHyperlink()
	{

		@Override
		public void linkExited()
		{
		}

		@Override
		public void linkEntered()
		{
		}

		@Override
		public void linkActivated()
		{
			IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
			try
			{
				IEditorPart editorPart = IDE.openEditorOnFileStore(page, EFS.getStore(new File(absoluteFilePath).toURI()));
				goToLine(editorPart, lineNumber);
			}
			catch (Exception exception)
			{
				throw new RuntimeException(exception);
			}
		}
	};
}
 
开发者ID:mjwach,项目名称:ErrorLinkyThing,代码行数:32,代码来源:ErrorLinkyPatternMatchListenerDelegate.java

示例10: addLink

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
/**
 * IConsole: Add a link to the console
 */
public void addLink(IHyperlink link, int offset, int length) {
    try {
        super.addHyperlink(link, offset, length);
    } catch (BadLocationException e) {
        Log.log(e);
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:11,代码来源:PydevConsole.java

示例11: onHandleClick

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
@Override
protected void onHandleClick(Object data) {
    if (data instanceof IHyperlink) {
        //The order is important (when activating it'll do a hide automatically,
        //but we want to do a hide without focusing the previous editor).
        this.hideInformationControl(false, false);
        ((IHyperlink) data).linkActivated();
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:10,代码来源:InformationPresenterWithLineTracker.java

示例12: lineAppended

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
public void lineAppended(IRegion line)
{
  try
  {
    int offset = line.getOffset();
    int length = line.getLength();
    String text = console.getDocument().get(offset, length);
    if (fErrorMatcher.match(text) || fWarningMatcher.match(text) || fBreakPointMatcher.match(text))
    {
      Matcher m = fLineNumberMatcher.matcher(text);
      if (m.find())
      {
        String lineNumber = text.substring(m.start(), m.end());
        String file = text.substring(0, m.start());

        Matcher m2 = fLineNumber.matcher(lineNumber);
        if (m2.find())
        {
          String lineNo = lineNumber.substring(m2.start(), m2.end());
          IHyperlink link = new DLabProConsoleHyperlink(lineNo, file, console);
          console.addLink(link, offset, m.end());
        }
      }
    }
  }
  catch (BadLocationException e)
  {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }

}
 
开发者ID:matthias-wolff,项目名称:dLabPro-Plugin,代码行数:33,代码来源:DLabProConsoleLineTracker.java

示例13: getHyperlink

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
public IHyperlink getHyperlink() {
    return viewer.getHyperlink();
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:4,代码来源:ScriptConsoleViewerWrapper.java

示例14: addLink

import org.eclipse.ui.console.IHyperlink; //导入依赖的package包/类
void addLink(IHyperlink link, int offset, int length); 
开发者ID:fabioz,项目名称:Pydev,代码行数:2,代码来源:ILinkContainer.java


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