Home » Newcomers » Newcomers » creating markers
creating markers [message #46694] |
Mon, 04 April 2005 07:11  |
Eclipse User |
|
|
|
Originally posted by: rakedash.in.ibm.com
hi,
i am getting problems in creating markers for an existing text document.i
am aiming at creating markers at specified line of a given text
doc(test.txt).but my code is throwing exception and it seems is not
getting the workspace.note the text.txt really exits.following is the code
for creating markers..
please let me know what could be the problem because of which it throws
exception and how to avoid this exception to create the markers..
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.resources.IMarker;
public class Test{
Test(){
}
public static void main(String[] args) throws CoreException{
new Test();
try{
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("project");
if(project.isOpen()){
System.out.println("opened");
}
/*IFolder folder = project.getFolder("Folder1");
IFile file = folder.getFile("test.txt");*/
IFile file= project.getFile("test.txt");
if (!project.exists()) project.create(null);
if (!project.isOpen()) project.open(null);
IResource res=file;
IMarker marker=res.createMarker(IMarker.PROBLEM);
if(marker.exists())
{
System.out.println("trace");
marker.setAttribute(IMarker.LINE_NUMBER,2);
marker.setAttribute(IMarker.MESSAGE,"test marker");
}
else{
System.out.println("marker ");
}
}
catch(Exception e){ System.out.println("error");
e.printStackTrace();}
}
}
please reply soon..
bye..
Rakesh
|
|
| | | | |
Re: simple working example of markers [message #52178 is a reply to message #50381] |
Thu, 14 April 2005 14:14   |
Eclipse User |
|
|
|
Originally posted by: Chris_Laffra.ca.ibm.com
Sam,
Actually, we can sue you. Even Google's cache contains the following
fragment:
Copyright 2004, Pearson Education, Inc.,
All Rights Reserved. The material is from
Official Eclipse 3.0 FAQs, published by
Addison-Wesley. No part of this
publication may be reproduced, stored
in a retrieval system, or transmitted,
in any form, or by any means, electronic,
mechanical, photocopying, recording,
or otherwise, without the prior
consent of the publisher.
I am not a lawyer, just a book author, but if you copy text from a book at
verbatim and submit it to a newsgroup while removing the copyright you
violate the above restriction, I think.
Mmm, let's say there are 10,000 readers to this newsgroup. The book has 361
FAQs @ $36.
Multiple 10,000 readers by the cost of one FAQ @ $0.10 => $1,000.
I think we could ask you to send us a check for that amount, but I have to
check with my lawyer.
--
Chris Laffra, http://eclipsefaq.org
"Sam Mesh" <SamMesh@gmail.com> wrote in message
news:d3e55c$59b$1@news.eclipse.org...
>
> This in an excerpt from
> <http://www.eclipsefaq.org/chris/faq/html/faq304.html>:
> (Chris and John, you can sue Google for caching it! :)
> *****************************
> Text editors in Eclipse can display markers in a number of ways. Most
> commonly, they appear as icons in the vertical rule on the left-hand
> side of the editor pane. Markers can also optionally be displayed as
> squiggly underlays in the text and in the overview ruler on the
> right-hand side of the editor. How each type of marker is displayed is
> chosen by the user on the editor preference pages (Workbench > Editors >
> Text Editor > Annotations and Java > Editor > Annotations). The IMarker
> interface declares a number of frequently used marker types. Any created
> marker that has either the LINE_NUMBER or CHAR_START and CHAR_END
> attributes set will be displayed by editors. These attributes must exist
> when the marker is created for the marker to appear in an editor. The
> most common mistake is to create the marker and then add the attributes
> in a separate operation. The text framework provides a utility class
> called MarkerUtilities to make this easier for you. Here is a sample
> snippet that adds a marker correctly:
>
>
> int lineNumber = ...;
> HashMap map = new HashMap();
> MarkerUtilities.setLineNumber(map, lineNumber);
> MarkerUtilities.createMarker(resource, map, IMarker.TEXT);
> *****************************
>
>
> > i was unable to follow the link to bugs.
>
> Please try again. You will definitely solve a lot of your problems
> accessing <https://bugs.eclipse.org>. Do not hesitate to ask guys in
> your domain - it's *ibm* or what?.. :)
>
> --
> HTH,
> Sam Mesh
|
|
|
Re: simple working example of markers [message #53157 is a reply to message #52178] |
Sun, 17 April 2005 12:11   |
Eclipse User |
|
|
|
Originally posted by: SamMesh.gmail.com
Thanks for the lesson, Chris!
Please be advised that I consider my citation inappropriate
and I already removed (canceled) my newsgroup article with this citation.
Please notify me about any occurrences of my inappropriate post and I'll
do my best to destroy them.
Also I'll do my best to receive "prior consent of the publisher" in the
future. I regret that such consent can not be received in this case.
I truly believe that good will should be tried before any legal actions
and hope we're on the same page in this question.
PS. Google treats legal issues seriously. This faq is not in cache anymore.
--
Sincerely,
Sam Mesh
Chris Laffra wrote:
> Sam,
>
> Actually, we can sue you. Even Google's cache contains the following
> fragment:
>
> Copyright 2004, Pearson Education, Inc.,
> All Rights Reserved. The material is from
> Official Eclipse 3.0 FAQs, published by
> Addison-Wesley. No part of this
> publication may be reproduced, stored
> in a retrieval system, or transmitted,
> in any form, or by any means, electronic,
> mechanical, photocopying, recording,
> or otherwise, without the prior
> consent of the publisher.
>
> I am not a lawyer, just a book author, but if you copy text from a book at
> verbatim and submit it to a newsgroup while removing the copyright you
> violate the above restriction, I think.
>
> Mmm, let's say there are 10,000 readers to this newsgroup. The book has 361
> FAQs @ $36.
> Multiple 10,000 readers by the cost of one FAQ @ $0.10 => $1,000.
> I think we could ask you to send us a check for that amount, but I have to
> check with my lawyer.
>
|
|
|
Re: simple working example of markers [message #53181 is a reply to message #53157] |
Sun, 17 April 2005 13:40  |
Eclipse User |
|
|
|
Originally posted by: Chris_Laffra.ca.ibm.com
Hi Sam,
We were not planning on sueing you for this particular action, don't worry.
I just wanted to make a point. I appreciate your apology. Thanks.
Furthermore, I don't believe Google reacts to legal issues from two simple
book authors. They just update their cache when the original pages gets
updated by the prospective publisher, which is what we did. I scarcely think
Googles scans pages to see if they contain legal statements.
--
Chris Laffra, http://eclipsefaq.org
"Sam Mesh" <SamMesh@gmail.com> wrote in message
news:d3u29n$pi2$1@news.eclipse.org...
> Thanks for the lesson, Chris!
>
> Please be advised that I consider my citation inappropriate
> and I already removed (canceled) my newsgroup article with this citation.
>
> Please notify me about any occurrences of my inappropriate post and I'll
> do my best to destroy them.
>
> Also I'll do my best to receive "prior consent of the publisher" in the
> future. I regret that such consent can not be received in this case.
>
> I truly believe that good will should be tried before any legal actions
> and hope we're on the same page in this question.
>
> PS. Google treats legal issues seriously. This faq is not in cache
anymore.
>
> --
> Sincerely,
> Sam Mesh
>
> Chris Laffra wrote:
> > Sam,
> >
> > Actually, we can sue you. Even Google's cache contains the following
> > fragment:
> >
> > Copyright 2004, Pearson Education, Inc.,
> > All Rights Reserved. The material is from
> > Official Eclipse 3.0 FAQs, published by
> > Addison-Wesley. No part of this
> > publication may be reproduced, stored
> > in a retrieval system, or transmitted,
> > in any form, or by any means, electronic,
> > mechanical, photocopying, recording,
> > or otherwise, without the prior
> > consent of the publisher.
> >
> > I am not a lawyer, just a book author, but if you copy text from a book
at
> > verbatim and submit it to a newsgroup while removing the copyright you
> > violate the above restriction, I think.
> >
> > Mmm, let's say there are 10,000 readers to this newsgroup. The book has
361
> > FAQs @ $36.
> > Multiple 10,000 readers by the cost of one FAQ @ $0.10 => $1,000.
> > I think we could ask you to send us a check for that amount, but I have
to
> > check with my lawyer.
> >
|
|
|
Goto Forum:
Current Time: Thu Mar 13 13:45:00 EDT 2025
Powered by FUDForum. Page generated in 0.06337 seconds
|